Package com.massifmaps.geocoding
Class MapBoxOnlineGeocodingService
java.lang.Object
com.massifmaps.geocoding.GeocodingService
com.massifmaps.geocoding.MapBoxOnlineGeocodingService
An online geocoding service that uses MapBox geocoder.
As the class connects to an external (non-Massif) service, this class is provided "as-is",
future changes from the service provider may not be compatible with the implementation.
Geocoding and reverse geocoding perform network requests and must be executed in non-UI background thread.
Be sure to read the Terms and Conditions of the MapBox service to see if the
service is available for your application.
Note: this class is experimental and may change or even be removed in future SDK versions.
As the class connects to an external (non-Massif) service, this class is provided "as-is",
future changes from the service provider may not be compatible with the implementation.
Geocoding and reverse geocoding perform network requests and must be executed in non-UI background thread.
Be sure to read the Terms and Conditions of the MapBox service to see if the
service is available for your application.
Note: this class is experimental and may change or even be removed in future SDK versions.
-
Constructor Summary
ConstructorsConstructorDescriptionMapBoxOnlineGeocodingService(String accessToken) Constructs a new instance of the MapBoxOnlineGeocodingService given API key. -
Method Summary
Modifier and TypeMethodDescriptioncalculateAddresses(GeocodingRequest request) Calculates matching addresses from the specified geocoding request.Returns the custom backend service URL.Returns the language of the expected results.intReturns the maximum number of results the geocoding service returns.booleanReturns the autocomplete flag of the service.voidsetAutocomplete(boolean autocomplete) Sets the autocomplete flag of the service.
By default this flag is off.voidsetCustomServiceURL(String serviceURL) Sets the custom backend service URL.voidsetLanguage(String lang) Sets the language of the expected results.voidsetMaxResults(int maxResults) Sets the maximum number of results the geocoding service returns.
The default number of results is service dependant (normally 10).
-
Constructor Details
-
MapBoxOnlineGeocodingService
Constructs a new instance of the MapBoxOnlineGeocodingService given API key.- Parameters:
accessToken- The access token to use (registered with MapBox).
-
-
Method Details
-
getCustomServiceURL
Returns the custom backend service URL.- Returns:
- The custom backend service URL. If this is not defined, an empty string is returned.
-
setCustomServiceURL
Sets the custom backend service URL.
The custom URL should contain tags "{query}" and "{access_token}" that will be substituted by the SDK.- Parameters:
serviceURL- The custom backend service URL to use. If this is empty, then the default service is used.
-
isAutocomplete
public boolean isAutocomplete()Description copied from class:GeocodingServiceReturns the autocomplete flag of the service.- Overrides:
isAutocompletein classGeocodingService- Returns:
- The autocomplete flag of the service.
-
setAutocomplete
public void setAutocomplete(boolean autocomplete) Description copied from class:GeocodingServiceSets the autocomplete flag of the service.
By default this flag is off.- Overrides:
setAutocompletein classGeocodingService- Parameters:
autocomplete- The new value for autocomplete flag.
-
getLanguage
Description copied from class:GeocodingServiceReturns the language of the expected results.- Overrides:
getLanguagein classGeocodingService- Returns:
- The language of the expected results. As ISO 639-1 code or empty string.
-
setLanguage
Description copied from class:GeocodingServiceSets the language of the expected results.- Overrides:
setLanguagein classGeocodingService- Parameters:
lang- The language to use as ISO 639-1 code. Empty string can be used for default language.
-
getMaxResults
public int getMaxResults()Description copied from class:GeocodingServiceReturns the maximum number of results the geocoding service returns.- Overrides:
getMaxResultsin classGeocodingService- Returns:
- The maximum number of results the geocoding service returns.
-
setMaxResults
public void setMaxResults(int maxResults) Description copied from class:GeocodingServiceSets the maximum number of results the geocoding service returns.
The default number of results is service dependant (normally 10).- Overrides:
setMaxResultsin classGeocodingService- Parameters:
maxResults- The new maximum number of results the geocoding service returns.
-
calculateAddresses
Description copied from class:GeocodingServiceCalculates matching addresses from the specified geocoding request.- Overrides:
calculateAddressesin classGeocodingService- Parameters:
request- The geocoding request to use.- Returns:
- The list of matching geocoding results, sorted by descending ranks.
- Throws:
IOException
-