<abstract> new Locator(options)
An abstract class for geocoding and geolocating
Parameters:
| Name | Type | Description |
|---|---|---|
options |
module:nyc/Locator~Locator.Options | Construction options |
- Source:
Fires:
Extends
Members
-
<static> Accuracy :number
-
Enumeration for approximate Geocoder accuracy in meters
Type:
- number
- Source:
Properties:
Name Type Default Description HIGHnumber 0 High accuracy
MEDIUMnumber 50 Medium accuracy
LOWnumber 500 Low accuracy
ZIP_CODEnumber 1000 ZIP Code accuracy
-
geocoder :module:nyc/Geocoder~Geocoder
-
The geocder
Type:
- Source:
-
projection :string
-
The epsg code
Type:
- string
- 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
- Source:
Returns:
The accurcy in map units
- Type
- number
-
<abstract> locate()
-
Locate once using device geolocation
- Source:
-
metersPerUnit()
-
Get a distance for an accuracy enumerator based on the projections
- 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
- Source:
-
<abstract> track(track)
-
Track using device geolocation
Parameters:
Name Type Description trackboolean Track or not
- 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
-
Ambiguous
-
Object type to hold data about possible locations resulting from a search request
Type:
- Object
- Source:
Properties:
Name Type Description inputstring The input string on which the geocoding attempt was made
typestring The event type
possibleArray.<module:nyc/Locator~Locator.Result> An array of possible results to the request
-
Options
-
Constructor options for module:nyc/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)
-
Result
-
Object type to hold data about a successful result of a geocoder search or device geolocation
Type:
- Object
- Source:
Properties:
Name Type Argument Description namestring The formatted name of the geocoded location
typestring The event type
coordinateArray.<number> | undefined The geocoded location coordinate
accuracynumber The accuracy of the geocoded location in meters or units of a specified projection
typestring They type of result (geocoded or geolocated)
zipboolean <optional>
Is this the geocoded location a ZIP Code center point
geometryObject <optional>
A geoJSON representation of the geocoded location coordinates
dataObject <optional>
Additional properties provided by the geocoder
Events
-
ambiguous
-
The result of an inconclusive search request
Type: module:nyc/Locator~Locator.Ambiguous
- Source:
-
error
-
The error object from a locate request error
Type: Object
- Source:
-
geocoded
-
The result of a search request
Type: module:nyc/Locator~Locator.Location
- Source:
-
geolocated
-
The result of a locate request
Type: module:nyc/Locator~Locator.Location
- Source: