Optional
opt_options: GeolocationOptionsOptions.
Helper class for providing HTML5 Geolocation capabilities. The Geolocation API is used to locate a user's position.
To get notified of position changes, register a listener for the generic
change
event on your instance of ol.Geolocation
.
Example:
var geolocation = new ol.Geolocation({
// take the projection to use from the map's view
projection: view.getProjection()
});
// listen to changes in position
geolocation.on('change', function(evt) {
window.console.log(geolocation.getPosition());
});
error
stable
Get the position of the device.
The current position of the device reported in the current projection.
stable
Get the projection associated with the position.
The projection the position is reported in.
stable
Get the tracking options.
PositionOptions as defined by the HTML5 Geolocation spec .
Listen for a certain type of event.
The event type or array of event types.
The listener function.
Optional
opt_this: ObjectThe object to use as this
in listener
.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
stable
Listen once for a certain type of event.
The event type or array of event types.
The listener function.
Optional
opt_this: ObjectThe object to use as this
in listener
.
Unique key for the listener. If called with an array of event types as the first argument, the return will be an array of keys.
stable
Set the projection to use for transforming the coordinates.
The projection the position is reported in.
stable
Sets a collection of key-value pairs. Note that this changes any existing properties and adds new ones (it does not remove any existing properties).
Values.
Optional
opt_silent: booleanUpdate without triggering an event.
stable
Set the tracking options.
PositionOptions as defined by the HTML5 Geolocation spec .
Static
unRemoves an event listener using the key returned by on()
or once()
.
Note that using the ol.Observable.unByKey static function is to
be preferred.
stable
Generated using TypeDoc
Classdesc
Helper class for providing HTML5 Geolocation capabilities. The Geolocation API is used to locate a user's position.
To get notified of position changes, register a listener for the generic
change
event on your instance ofol.Geolocation
.Example:
Fires
error
Param: opt_options
Options.
Api
stable