The Geolocate control wraps w3c geolocation API into control that can be bound to a map, and generate events on location update
To use this control requires to load the proj4js library if the projection of the map is not EPSG:4326 or EPSG:900913.
ALKMaps. | The Geolocate control wraps w3c geolocation API into control that can be bound to a map, and generate events on location update |
Properties | |
events | {ALKMaps.Events} Events instance for listeners and triggering control specific events. |
geolocation | {Object} The geolocation engine, as a property to be possibly mocked. |
bind | {Boolean} If true, map center will be set on location update. |
watch | {Boolean} If true, position will be update regularly. |
geolocationOptions | {Object} Options to pass to the navigator’s geolocation API. |
Constructor | |
ALKMaps. | Create a new control to deal with browser geolocation API |
Functions | |
destroy | |
activate | Activates the control. |
deactivate | Deactivates the control. |
geolocate | Activates the control. |
getCurrentLocation | {Boolean} Returns true if a event will be fired (successful registration) |
failure | method called on browser’s geolocation failure |
{ALKMaps.Events} Events instance for listeners and triggering control specific events.
control.events.register(type, obj, listener);
locationupdated | Triggered when browser return a new position. Listeners will receive an object with a ‘position’ property which is the browser.geolocation.position native object, as well as a ‘point’ property which is the location transformed in the current map projection. |
locationfailed | Triggered when geolocation has failed |
locationuncapable | Triggered when control is activated on a browser which doesn’t support geolocation |
{Object} Options to pass to the navigator’s geolocation API. See https://w3c.github.io/geolocation-api/. No specific option is passed to the geolocation API by default.
destroy: function()
Activates the control.
activate: function ()
Deactivates the control.
deactivate: function ()
Activates the control.
geolocate: function ( position )
{Boolean} Returns true if a event will be fired (successful registration)
getCurrentLocation: function()
method called on browser’s geolocation failure
failure: function ( error )