reverseGeocode

Translates geographic coordinates (latitude and longitude) into a human-readable address.

The reverse geocoder attempts to describe the location, providing information such as area names ("Amsterdam, Netherlands") or detailed addresses ("Oosterdoksstraat 114, 1011 DK Amsterdam, Netherlands").

Note: This is a synchronous operation and it must not be executed on the main thread.

Usage Example:

// Create a reverse geocoder instance.
val reverseGeocoder = ReverseGeocoderImplementation(...)

val options = ReverseGeocoderOptions(position = GeoPoint(52.391174, 4.910375))

val result = reverseGeocoder.reverseGeocode(options)

if (result.isSuccess()) {
val response = result.value()
// Process the reverse geocoding response.
Log.d(response)
} else {
val failure = result.failure()
// Handle the reverse geocoding failure.
Log.d(failure.message)
}

Return

A Result object that holds either a ReverseGeocoderResponse containing matched addresses if the operation succeeds, or a SearchFailure in case of failure.

Parameters

options

Specifies the input and filters of the request. For example, the location to be reverse geocoded and the desired language of the returned result.


Translates geographic coordinates (latitude and longitude) into a human-readable address. This operation is asynchronous; the result is delivered through the specified callback.

The reverse geocoder attempts to describe the location, providing information such as area names ("Amsterdam, Netherlands") or detailed addresses ("Oosterdoksstraat 114, 1011 DK Amsterdam, Netherlands").

This operation is asynchronous; the result is delivered through the specified callback.

Note: The callback is executed on the main thread.

Usage example:

// Create a reverse geocoder instance.
val reverseGeocoder: ReverseGeocoder = ReverseGeocoderImplementation(...)

val options = ReverseGeocoderOptions(position = GeoPoint(52.391174, 4.910375))

val callback = object : ReverseGeocoderCallback {
override fun onSuccess(response: ReverseGeocoderResponse) {
// Process the reverse geocoding response.
Log.d(response)
}

override fun onFailure(failure: SearchFailure) {
// Handle the reverse geocoding failure.
Log.d(failure.message)
}
}

val cancellable = reverseGeocoder.reverseGeocode(options, callback)

// You can cancel the operation if needed:
cancellable.cancel()

Return

A Cancellable object that stop the ongoing operation if needed. The object manages and cancels the reverse geocoding operation if it hasn't been completed yet.

Parameters

options

Specifies the input and filters of the request. For example, the location to be reverse geocoded and the desired language of the returned result.

callback

The ReverseGeocoderCallback that is invoked asynchronously when the reverse geocoding operation completes, whether successfully or with an error.