靜態unGet the position of the device.
The current position of the device reported in the current projection.
Get the projection associated with the position.
The projection the position is reported in.
Get the tracking options.
PositionOptions as defined by the HTML5 Geolocation spec .
Set the projection to use for transforming the coordinates.
The projection the position is reported in.
Set 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.
可選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.
Listen once for a certain type of event.
The event type or array of event types.
The listener function.
可選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.
函數Removes an event listener using the key returned by on() or once().
Note that using the ol.Observable.unByKey static function is to
be preferred.
可選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());
});
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
changeevent on your instance ofol.Geolocation.Example:
Fires
error
參數: opt_options
Options.
Api
stable