public abstract class MapboxGeocoding extends com.mapbox.core.MapboxService<GeocodingResponse,GeocodingService>
Forward geocoding lets you convert location text into geographic coordinates, turning
2 Lincoln Memorial Circle NW
into a Point
with the coordinates
-77.050, 38.889
.
Reverse geocoding turns geographic coordinates into place names, turning -77.050, 38.889
into 2 Lincoln Memorial Circle NW
. These place names can vary from specific addresses to
states and countries that contain the given coordinates.
Batch Geocoding
The mode()
must be set to
GeocodingCriteria.MODE_PLACES_PERMANENT
.
For more information about batch geocoding, contact Mapbox sales.
Batch requests have the same parameters as normal requests, but can include more than one query
by using MapboxGeocoding.Builder.query(String)
and separating queries with the ;
character.
With the GeocodingCriteria.MODE_PLACES_PERMANENT
mode, you can make up to 50 forward or
reverse geocoding queries in a single request. The response is a list of individual
GeocodingResponse
s. Each query in a batch request counts individually against your
account's rate limits.
Modifier and Type | Class and Description |
---|---|
static class |
MapboxGeocoding.Builder
This builder is used to create a new request to the Mapbox Geocoding API.
|
Modifier | Constructor and Description |
---|---|
protected |
MapboxGeocoding() |
Modifier and Type | Method and Description |
---|---|
protected abstract java.lang.String |
baseUrl() |
static MapboxGeocoding.Builder |
builder()
|
void |
cancelBatchCall()
Wrapper method for Retrofits
Call.cancel() call, important to manually cancel call if
the user dismisses the calling activity or no longer needs the returned results. |
retrofit2.Call<java.util.List<GeocodingResponse>> |
cloneBatchCall()
Wrapper method for Retrofits
Call.clone() call, useful for getting call information. |
void |
enqueueBatchCall(retrofit2.Callback<java.util.List<GeocodingResponse>> callback)
Wrapper method for Retrofits
Call.enqueue(Callback) call returning a batch response
specific to the Geocoding batch API. |
retrofit2.Response<java.util.List<GeocodingResponse>> |
executeBatchCall()
Wrapper method for Retrofits
Call.execute() call returning a batch response specific to
the Geocoding API. |
protected com.google.gson.GsonBuilder |
getGsonBuilder() |
protected retrofit2.Call<GeocodingResponse> |
initializeCall() |
protected com.google.gson.GsonBuilder getGsonBuilder()
getGsonBuilder
in class com.mapbox.core.MapboxService<GeocodingResponse,GeocodingService>
protected retrofit2.Call<GeocodingResponse> initializeCall()
initializeCall
in class com.mapbox.core.MapboxService<GeocodingResponse,GeocodingService>
public retrofit2.Response<java.util.List<GeocodingResponse>> executeBatchCall() throws java.io.IOException
Call.execute()
call returning a batch response specific to
the Geocoding API.java.io.IOException
- Signals that an I/O exception of some sort has occurred.public void enqueueBatchCall(retrofit2.Callback<java.util.List<GeocodingResponse>> callback)
Call.enqueue(Callback)
call returning a batch response
specific to the Geocoding batch API. Use this method to make a geocoding request on the Main
Thread.callback
- a Callback
which is used once the GeocodingResponse
is created.public void cancelBatchCall()
Call.cancel()
call, important to manually cancel call if
the user dismisses the calling activity or no longer needs the returned results.public retrofit2.Call<java.util.List<GeocodingResponse>> cloneBatchCall()
Call.clone()
call, useful for getting call information.@NonNull protected abstract java.lang.String baseUrl()
baseUrl
in class com.mapbox.core.MapboxService<GeocodingResponse,GeocodingService>
public static MapboxGeocoding.Builder builder()
MapboxGeocoding.Builder
object for creating this object