new IWGeoLocationUtils()
Methods
-
findAddress(options)
-
Finds the nearest address at the users location.
Triggers one of the events
onlocationfound
andonerror
. If the location could be determined, the event object will contain the coordinate, the accuracy, the nearest address and the distance between the coordinate and the address.If the geolocation API is not available or the user gave no permission to use the location, the error handler is called.
Parameters:
Name Type Description options
object options as described above Returns:
- Type
- void
-
isAvailable()
-
Checks whether geolocation functionality is available or not.
Returns:
- Type
- boolean
-
locate(map, options)
-
Locates the user on the map. Triggers one of the events
onpositionchange
andonerror
.Example:
// set the map to the geo location if a result is found in 500 ms IWGeolocationUtils.locate(map, { updateMap: true, showRadius: false, timeout: 500, enableHighAccuracy: false });
Parameters:
Name Type Description map
IWMap a map options
object options as described above Returns:
- Type
- void
-
stopTracking()
-
Stops tracking the user. This stops map updates and
onpositionchange
events.Returns:
- Type
- void
-
track(map, options)
-
Tracks the user and updates the map every time a new location is found (unless
stopTracking()
is called). Everytime there is a new location a newonpositionchange
event will be fired.Example:
// draw a red circle every time there is a new location with an accuracy of at least 100 meters var options = { updateMap: false, enableHighAccuracy: true, showRadius: true, maxDrawingRadius: 100 attributes: { fill: 'red', fillOpacity: 0.2, strokeWidth: 3, stroke: 'red', strokeOpacity: 0.6 } }; IWGeoLocationUtils.track(map, options);
Parameters:
Name Type Description map
IWMap a map options
object options as described above Returns:
- Type
- void