Class: GeolocationDraw

ol.interaction. GeolocationDraw


new GeolocationDraw(options)

Interaction to draw on the current geolocation It combines a draw with a ol.Geolocation

Parameters:
Name Type Description
options any
option.features ol.Collection.<ol.Feature> | undefined

Destination collection for the drawn features.

options.source ol.source.Vector | undefined

Destination source for the drawn features.

options.type ol.geom.GeometryType

Drawing type ('Point', 'LineString', 'Polygon'), default LineString.

options.minAccuracy Number | undefined

minimum accuracy underneath a new point will be register (if no condition), default 20

options.condition function | undefined

a function that take a ol.Geolocation object and return a boolean to indicate whether location should be handled or not, default return true if accuraty < minAccuraty

options.attributes Object

a list of attributes to register as Point properties: {accuracy:true,accuracyGeometry:true,heading:true,speed:true}, default none.

options.tolerance Number

tolerance to add a new point (in projection unit), use ol.geom.LineString.simplify() method, default 5

options.zoom Number

zoom for tracking, default 16

options.followTrack boolean | auto | position | visible

true if you want the interaction to follow the track on the map, default true

options.style ol.style.Style | Array.<ol.style.Style> | ol.StyleFunction | undefined

Style for sketch features.

Fires:
  • drawstart, drawend, drawing, tracking,event: follow

Extends

  • ol.interaction.Interaction

Methods


isPaused()

Is paused

Returns:

b

Type
boolean

pause(b)

Pause drawing

Parameters:
Name Type Description
b boolean

reset()

Reset drawing


setActive(active)

Activate or deactivate the interaction.

Parameters:
Name Type Description
active boolean

setFollowTrack(follow,)

Enable following the track on the map

Parameters:
Name Type Description
follow, boolean | auto | position | visible

false: don't follow, true: follow (position+zoom), 'position': follow only position, 'auto': start following until user move the map, 'visible': center when position gets out of the visible extent


setMap(map)

Remove the interaction from its current map, if any, and attach it to a new map, if any. Pass null to just remove the interaction from the current map.

Parameters:
Name Type Description
map ol.Map

Map.


start()

Start tracking = setActive(true)


stop()

Stop tracking = setActive(false)