new Locator(options)
A class for geocoding and geolocating in OpenLayers
Parameters:
| Name | Type | Description |
|---|---|---|
options |
module:nyc/ol/Locator~Locator.Options | Constructor options |
- Source:
Extends
Members
-
geocoder :module:nyc/Geocoder~Geocoder
-
The geocder
Type:
- Inherited From:
- Overrides:
- Source:
-
projection :string
-
The epsg code
Type:
- string
- Inherited From:
- Overrides:
- Source:
Methods
-
<protected> accuracyDistance(accuracy)
-
Get a distance for an accuracy enumerator based on the Locator projection
Parameters:
Name Type Description accuracymodule:nyc/Locator~Locator.Accuracy Locator accuracy
- Inherited From:
- Overrides:
- Source:
Returns:
The accurcy in map units
- Type
- number
-
locate()
-
Locate once using device geolocation
- Inherited From:
- Overrides:
- Source:
-
metersPerUnit()
-
Get a distance for an accuracy enumerator based on the projections
- Inherited From:
- Overrides:
- Source:
Returns:
The meters per map unit
- Type
- number
-
off(eventName, evtHdlr [, hdlrScope])
-
Remove a previously connected event handler
Parameters:
Name Type Argument Description eventNamestring The name of the event to which the handler will be connected
evtHdlrfunction The event handler function
hdlrScopeObject <optional>
The scope in which to invoke the event handler
- Inherited From:
- Overrides:
- Source:
-
on(eventName, evtHdlr [, hdlrScope])
-
Connect a function to an event
Parameters:
Name Type Argument Description eventNamestring The name of the event to which the handler will be connected
evtHdlrfunction The event handler function
hdlrScopeObject <optional>
The scope in which to invoke the event handler
- Inherited From:
- Overrides:
- Source:
-
one(eventName, evtHdlr [, hdlrScope])
-
Connect a function to an event for a single invocation
Parameters:
Name Type Argument Description eventNamestring The name of the event to which the handler will be connected
evtHdlrfunction The event handler function
hdlrScopeObject <optional>
The scope in which to invoke the event handler
- Inherited From:
- Overrides:
- Source:
-
<abstract> search(input)
-
Geocode an input string representing a location
Parameters:
Name Type Description inputstring The value to geocode
- Inherited From:
- Overrides:
- Source:
-
track(track)
-
Track using device geolocation
Parameters:
Name Type Description trackboolean Track or not
- Inherited From:
- Overrides:
- Source:
-
trigger(eventName [, data])
-
Trigger a named event with event data
Parameters:
Name Type Argument Description eventNamestring The name of the event to trigger
dataObject <optional>
The event data
- Inherited From:
- Overrides:
- Source:
Type Definitions
-
Options
-
constructor options for module:nyc/ol/Locator~Locator
Type:
- Object
- Source:
Properties:
Name Type Argument Default Description geocodermodule:nyc/Geocoder~Geocoder A geocoder
projectionstring <optional>
EPSG:3857 The EPSG code of the projection for output geometries (i.e. EPSG:2263)
extentLimitol.Extent <optional>
Geolocation coordinates outside of this bounding box are ignored
Events
-
ambiguous
-
The result of an inconclusive search request
Type: module:nyc/Locator~Locator.Ambiguous
- Inherited From:
- Overrides:
- Source:
-
error
-
The error object from a locate request error
Type: Object
- Inherited From:
- Overrides:
- Source:
-
geocoded
-
The result of a search request
Type: module:nyc/Locator~Locator.Location
- Inherited From:
- Overrides:
- Source:
-
geolocated
-
The result of a locate request
Type: module:nyc/Locator~Locator.Location
- Inherited From:
- Overrides:
- Source: