Skip to content

GeolocateControl

GeolocateControl

定位控件

继承Control
实现IControl

Examples

javascript
const gCtrol = new GeolocateControl()
map.addControl(gCtrol, "right-right")

constructor

构造函数

Parameters

  • options {positionOptions: (PositionOptions | undefined)?, fitBoundsOptions: (FitBoundsOptions | undefined)?, trackUserLocation: (boolean | undefined)?, showAccuracyCircle: (boolean | undefined)?, showUserLocation: (boolean | undefined)?, showUserHeading: (boolean | undefined)?, geolocation: (Geolocation | undefined)?}? 可选参数对象。

    • options.positionOptions 定位选项对象。
    • options.fitBoundsOptions 自适应地图视野选项对象。
    • options.trackUserLocation 是否追踪用户位置,默认为 false。
    • options.showAccuracyCircle 是否显示用户位置精度圈,默认为 true。
    • options.showUserLocation 是否显示用户位置,默认为 false。
    • options.showUserHeading 是否显示用户朝向,默认为 false。
    • options.geolocation 自定义 Geolocation 对象。

trigger

触发定位

Returns boolean