<abstract, protected> new Locator(options)
Creates an instance of Locator
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 HIGH
number 0 High accuracy
MEDIUM
number 50 Medium accuracy
LOW
number 500 Low accuracy
ZIP_CODE
number 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 accuracy
module: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 eventName
string The name of the event to which the handler will be connected
evtHdlr
function The event handler function
hdlrScope
Object <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 eventName
string The name of the event to which the handler will be connected
evtHdlr
function The event handler function
hdlrScope
Object <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 eventName
string The name of the event to which the handler will be connected
evtHdlr
function The event handler function
hdlrScope
Object <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 input
string The value to geocode
- Source:
-
<abstract> track(track)
-
Track using device geolocation
Parameters:
Name Type Description track
boolean Track or not
- Source:
-
trigger(eventName [, data])
-
Trigger a named event with event data
Parameters:
Name Type Argument Description eventName
string The name of the event to trigger
data
Object <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 input
string The input string on which the geocoding attempt was made
possible
Array.<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 geocoder
module:nyc/Geocoder~Geocoder A geocoder
projection
string <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 name
string The formatted name of the geocoded location
type
string The event type
coordinate
Array.<number> | undefined The geocoded location coordinate
accuracy
number The accuracy of the geocoded location in meters or units of a specified projection
type
string They type of result (geocoded or geolocated)
zip
boolean <optional>
Is this the geocoded location a ZIP Code center point
geometry
Object <optional>
A geoJSON representation of the geocoded location coordinates
data
Object <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: