Provides functions to move a map based on the device's reported location.
Requires: valid Proj4JS projection to be in use by OpenLayers. Requires: secure context (i.e. must be requested using HTTPS). This is needed by the standard Geolocation API. (See https://developer.mozilla.org/en-US/docs/Web/API/Geolocation_API.)
Methods
(inner) NotAvailableError(reason) → {Error}
Returns an error with a reason why devicelocation can't do anything
Parameters:
Name | Type | Description |
---|---|---|
reason |
string | Why devicelocation isn't available |
Returns:
Error with verbose message
- Type
- Error
(inner) centerMapOnDevice(map) → {Promise.<ol/coordinate~Coordinate>}
Creates a temporary Geolocation object and centres the map.
Parameters:
Name | Type | Description |
---|---|---|
map |
ol/Map~Map | OpenLayers Map |
Returns:
Centre of map
- Type
- Promise.<ol/coordinate~Coordinate>