reverseLookup(coordinate, callback, options)
Converts a geographic coordinate to an address.
Declaration
reverseLookup(
coordinate: Coordinate,
callback: (error: Error | null, result?: GeocoderResponse) => void,
options?: GeocoderReverseLookupOptions,
): number;Parameters
- coordinate:
The coordinate to convert to a human-readable address. For example,
new``Coordinate```(37.779268, -122.419248)`, which represents San Francisco City Hall. - callback:
MapKit JS invokes this callback function with two arguments,
erroron failure anddataon success. If you cancel the request before you receive a response, the framework doesn’t call this function.error(Error). Contains an error code and descriptive message.data(Object). An array of places named Results, which is an object the system parses from a server-returned JSON response. Each place in Results has a Coordinate property and a Formattedaddress property. Results is an empty array if there isn’t a match.
- options:
Language is the only option that you can set for the reverse geocoder. For example,
{ language: 'fr-CA' }tells the server to send results localized to Canadian French. If you set it, this option overrides the language you provide in the Geocoder constructor.
Return Value
A request ID that you can pass to cancel(id) to stop a pending request.
Discussion
Reverse geocoding converts geographic coordinates to the nearest human-readable address.