The GeoLocatorProvider
interface allows you to write your own integration with a third-party geo-location provider service. An implementation of the GeoLocatorProvider
interface must implement the following methods:
isAllowFreeFormEntry()
– This Boolean method identifies if the provider can use a form entry method with an arbitrary format. Iftrue
, addresses can take formats such as “1 Main Street” or “Boston MA”. If set tofalse
, the only format that can be used withgetGeoLocation
is the postal code, such as “02118”.isAllowCityAndState()
– This Boolean method indicates if the provider will support only postal codes, or free form address locations. If set tofalse
, then city and state are not valid inputs for location. Iftrue
, the provider supports city and state as inputs.getGeoLocation(string pPostalOrAddress, Locale plocale)
– This method finds a location based on a free form address or postal code. It uses the following parameters:pPostalOrAddress
– If theisFreeFormEntry
method is set totrue
, this parameter provides an address string. If set tofalse
, the parameter provides a postal code.pLocale
– The locale of the input, which can used to determine both the country and language of the location.
getGeoLocation(string pCity, String pArea, Locale plocale)
– This method finds a location based on a city and state or province. It uses the following parameters:pCity
– Use this parameter to identify a city for which you want coordinates.pArea
– This parameter allows you to input a general area, such as a state or province, where the city is located.pLocale
– The locale of the input, which can used to determine both the country and language of the location.
The GeoLocatorService
wraps the GeoLocatorProvider
functionality, and uses the following properties:
defaultLocale
– Identifies the default locale to use. If this property is null, it returns the default locale used by the JVM.provider
– This parameter identifies whichGeoLocatorProvider
to use to determine a coordinate based on an address.
You can configure the implementation of your GeoLocatorProvider
. For example, you might create a component based on your GeoLocatorProvider
with only the class provided. Then you can configure the Booleans on the GeoLocatorProvider
to use getters and setters and set them in the component, or set them programmatically.