Package com.massifmaps.geocoding
Class GeocodingService
java.lang.Object
com.massifmaps.geocoding.GeocodingService
- Direct Known Subclasses:
MapBoxOnlineGeocodingService,MultiOSMOfflineGeocodingService,OSMOfflineGeocodingService,PackageManagerGeocodingService,PeliasOnlineGeocodingService,TomTomOnlineGeocodingService
An abstract base class for geocoding services.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncalculateAddresses(GeocodingRequest request) Calculates matching addresses from the specified geocoding request.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.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
-
GeocodingService
protected GeocodingService()The default constructor.
-
-
Method Details
-
isAutocomplete
public boolean isAutocomplete()Returns the autocomplete flag of the service.- Returns:
- The autocomplete flag of the service.
-
setAutocomplete
public void setAutocomplete(boolean autocomplete) Sets the autocomplete flag of the service.
By default this flag is off.- Parameters:
autocomplete- The new value for autocomplete flag.
-
getLanguage
Returns the language of the expected results.- Returns:
- The language of the expected results. As ISO 639-1 code or empty string.
-
setLanguage
Sets the language of the expected results.- Parameters:
lang- The language to use as ISO 639-1 code. Empty string can be used for default language.
-
getMaxResults
public int getMaxResults()Returns the maximum number of results the geocoding service returns.- Returns:
- The maximum number of results the geocoding service returns.
-
setMaxResults
public void setMaxResults(int maxResults) Sets the maximum number of results the geocoding service returns.
The default number of results is service dependant (normally 10).- Parameters:
maxResults- The new maximum number of results the geocoding service returns.
-
calculateAddresses
Calculates matching addresses from the specified geocoding request.- Parameters:
request- The geocoding request to use.- Returns:
- The list of matching geocoding results, sorted by descending ranks.
- Throws:
Exception- If IO error occured during the calculation.IOException
-