reverseGeocode

Translates a location in 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 specific 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 = OfflineReverseGeocoder.create(ndsStore)

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 containing either a ReverseGeocoderResponse with matched addresses on success, or a SearchFailure on failure.

Parameters

options

Specifies the input and filters of the request, such as the location to be reverse geocoded and the desired language for the returned result.


Asynchronously translates a location in 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 specific addresses ("Oosterdoksstraat 114, 1011 DK Amsterdam, Netherlands").

Usage example:

// Create a reverse geocoder instance.
val reverseGeocoder = OfflineReverseGeocoder.create(ndsStore)

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 instance that can be used to cancel the asynchronous operation if needed.

Parameters

options

Specifies the input and filters of the request, such as the location to be reverse geocoded and the desired language for the returned result.

callback

The ReverseGeocoderCallback invoked asynchronously when the search operation finishes, either successfully or with an error. The callback executes on the main thread.