lookup(place, callback, options)
Converts an address to geographic coordinates.
Declaration
lookup(
place: string,
callback: (
error: Error | null,
result: GeocoderResponse | null,
) => void,
options?: GeocoderLookupOptions,
): Promise<GeocoderResponse>;Parameters
- place:
A case-insensitive string MapKit JS converts to geographic coordinates, such as: “
San Francisco City Hall”, “San Francisco City Hall, San Francisco”, “San Francisco City Hall, San Francisco, CA USA”. Delimiter characters are optional. - callback:
MapKit JS returns geocoding results asynchronously through a callback function. MapKit JS invokes the callback function with two arguments,
erroron failure anddataon success.error(Error). Contains an error code and descriptive message.data(Geocoderresponse). An object that contains an array of places named Results.
- options:
The geocoder returns the most relevant results for a query. For example, a query for Paris returns results for Paris, France. Use Geocoderlookupoptions to constrain the search to specific countries, or to a desired area with a coordinate or region.
Return Value
A promise that resolves with a GeocoderResponse on success.
Discussion
Geocoding converts a human-readable address to latitude and longitude coordinates. You can use Geocoder to look up coordinates for a city, landmark, or address.