OnlineReverseGeocoder
public final class OnlineReverseGeocoder : ReverseGeocoder
Implementation of the Reverse Geocoding API based on TomTom’s online service. Reverse geocoding is the process of translating geographic coordinates in the form of latitude and longitude into a readable address or location description that can be easily understood by humans. This process makes possible the identification of specific location details such as the street address, city, postal code, and other relevant information associated with a particular location on a map. For example, the location (52.391174, 4.910375) can be translated to the address (Distelweg, 141031 HE, Amsterdam). A typical use case is for the end user to click on the map and see the address at the clicked position.
-
Creates a new
OnlineReverseGeocoder
instance.Declaration
Swift
public convenience init(apiKey: String, customAPIURL: URL? = nil, geopoliticalView: String? = nil)
Parameters
apiKey
A valid TomTom API Key.
customAPIURL
Custom base URL for online APIs. Defaults to nil and “https://api.tomtom.com/search/2” will be the base URL. Can be used to change to another service that implements the same API.
geopoliticalView
The country code in the ISO 3166-1 alpha-2 format whose view on disputed areas should be used. If not provided, or not supported, the international geopolitical view will be used.
-
Translates a location, in the form of latitude and longitude, into a human-readable address. The reverse geocoder will attempt to describe the location, which may be an area name such as “Amsterdam, Netherlands”, an address such as “Oosterdoksstraat 114, 1011 DK Amsterdam, Netherlands”, and so forth.
Declaration
Swift
public func reverseGeocode( options: ReverseGeocoderOptions, completion: @escaping (Result<ReverseGeocoderResponse, Error>) -> () )
Parameters
options
Specifies the input and filters of the request. For example, the location to be reverse geocoded and the language of the returned result.
completion
Containing either a
ReverseGeocoderResponse
with the matched addresses if the call succeeds, or anError
if it fails.