org.opengts.geocoder.google
Class GoogleGeocodeV2

java.lang.Object
  extended by org.opengts.geocoder.ReverseGeocodeProviderAdapter
      extended by org.opengts.geocoder.google.GoogleGeocodeV2
All Implemented Interfaces:
GeocodeProvider, ReverseGeocodeProvider

public class GoogleGeocodeV2
extends ReverseGeocodeProviderAdapter
implements ReverseGeocodeProvider, GeocodeProvider


Field Summary
protected static java.lang.String ATTR_Accuracy
           
protected static java.lang.String ATTR_id
           
protected static java.lang.String CLIENT_ID_PREFIX
           
protected static java.lang.String DEFAULT_COUNTRY
           
protected static java.lang.String ENCODING_UTF8
           
protected static boolean FAILOVER_DEBUG
           
protected static double MAX_ADDRESS_DISTANCE_KM
           
protected static java.lang.String PROP_channel
           
protected static java.lang.String PROP_countryCodeBias
           
protected static java.lang.String PROP_geocodeURL
           
protected static java.lang.String PROP_reverseGeocodeURL
           
protected static java.lang.String PROP_sensor
           
protected static java.lang.String PROP_signatureKey
           
protected static java.lang.String TAG_address
           
protected static java.lang.String TAG_AddressDetails
           
protected static java.lang.String TAG_AdministrativeArea
           
protected static java.lang.String TAG_AdministrativeAreaName
           
protected static java.lang.String TAG_code
           
protected static java.lang.String TAG_coordinates
           
protected static java.lang.String TAG_Country
           
protected static java.lang.String TAG_CountryName
           
protected static java.lang.String TAG_CountryNameCode
           
protected static java.lang.String TAG_kml
           
protected static java.lang.String TAG_Locality
           
protected static java.lang.String TAG_LocalityName
           
protected static java.lang.String TAG_name
           
protected static java.lang.String TAG_Placemark
           
protected static java.lang.String TAG_Point
           
protected static java.lang.String TAG_PostalCode
           
protected static java.lang.String TAG_PostalCodeNumber
           
protected static java.lang.String TAG_request
           
protected static java.lang.String TAG_Response
           
protected static java.lang.String TAG_Status
           
protected static int TIMEOUT_Geocode
           
protected static int TIMEOUT_ReverseGeocode
           
protected static java.lang.String URL_Geocode_
           
protected static java.lang.String URL_ReverseGeocode_
           
 
Fields inherited from class org.opengts.geocoder.ReverseGeocodeProviderAdapter
_PROP_isEnabled, DEFAULT_MAX_FAILOVER_SECONDS, MIN_FAILOVER_SECONDS, PROP_alwaysFast, PROP_maxFailoverSeconds, PROP_ReverseGeocodeProvider_
 
Constructor Summary
GoogleGeocodeV2(java.lang.String name, java.lang.String key, RTProperties rtProps)
           
 
Method Summary
 ReverseGeocode getAddressReverseGeocode(GeoPoint gp, java.lang.String localeStr, boolean cache)
           
protected  java.lang.String getAddressReverseGeocodeURI()
           
protected  java.lang.String getAddressReverseGeocodeURL(GeoPoint gp, java.lang.String localStr)
           
 GeoPoint getGeocode(java.lang.String address, java.lang.String country)
          Returns GeoPoint of specified address
protected  int getGeocodeTimeout()
          Returns the Geocode timeout
protected  java.lang.String getGeoPointGeocodeURI()
           
protected  java.lang.String getGeoPointGeocodeURL(java.lang.String address, java.lang.String country)
           
protected static java.lang.String GetNodeText(org.w3c.dom.Node root)
           
 ReverseGeocode getReverseGeocode(GeoPoint gp, java.lang.String localeStr, boolean cache)
          Returns the best address for the specified GeoPoint
protected  int getReverseGeocodeTimeout()
          Returns the ReverseGeocode timeout
 GoogleSig getSignature()
           
protected static org.w3c.dom.Document GetXMLDocument(java.lang.String url, int timeoutMS)
           
 boolean isFastOperation()
          Returns true if this operation will take less than about 20ms to complete the returned value is used to determine whether the 'getReverseGeocode' operation should be performed immediately, or lazily (ie.
static void main(java.lang.String[] argv)
          Main entery point for debugging/testing
 
Methods inherited from class org.opengts.geocoder.ReverseGeocodeProviderAdapter
_getUserPass, _main, getAuthorization, getFailoverReverseGeocodeProvider, getFailoverReverseGeocodeProviderName, getMaximumFailoverElapsedSec, getName, getPassword, getProperties, getUsername, hasFailoverReverseGeocodeProvider, isEnabled, isReverseGeocodeFailoverMode, setAuthorization, setFailoverReverseGeocodeProvider, setName, setProperties, startReverseGeocodeFailoverMode, startReverseGeocodeFailoverMode, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.opengts.geocoder.ReverseGeocodeProvider
getFailoverReverseGeocodeProvider, getName, isEnabled, setFailoverReverseGeocodeProvider
 
Methods inherited from interface org.opengts.geocoder.GeocodeProvider
getName, isEnabled
 

Field Detail

TAG_kml

protected static final java.lang.String TAG_kml
See Also:
Constant Field Values

TAG_Response

protected static final java.lang.String TAG_Response
See Also:
Constant Field Values

TAG_name

protected static final java.lang.String TAG_name
See Also:
Constant Field Values

TAG_Status

protected static final java.lang.String TAG_Status
See Also:
Constant Field Values

TAG_code

protected static final java.lang.String TAG_code
See Also:
Constant Field Values

TAG_request

protected static final java.lang.String TAG_request
See Also:
Constant Field Values

TAG_Placemark

protected static final java.lang.String TAG_Placemark
See Also:
Constant Field Values

TAG_address

protected static final java.lang.String TAG_address
See Also:
Constant Field Values

TAG_AddressDetails

protected static final java.lang.String TAG_AddressDetails
See Also:
Constant Field Values

TAG_Country

protected static final java.lang.String TAG_Country
See Also:
Constant Field Values

TAG_CountryNameCode

protected static final java.lang.String TAG_CountryNameCode
See Also:
Constant Field Values

TAG_CountryName

protected static final java.lang.String TAG_CountryName
See Also:
Constant Field Values

TAG_AdministrativeArea

protected static final java.lang.String TAG_AdministrativeArea
See Also:
Constant Field Values

TAG_AdministrativeAreaName

protected static final java.lang.String TAG_AdministrativeAreaName
See Also:
Constant Field Values

TAG_Locality

protected static final java.lang.String TAG_Locality
See Also:
Constant Field Values

TAG_LocalityName

protected static final java.lang.String TAG_LocalityName
See Also:
Constant Field Values

TAG_PostalCode

protected static final java.lang.String TAG_PostalCode
See Also:
Constant Field Values

TAG_PostalCodeNumber

protected static final java.lang.String TAG_PostalCodeNumber
See Also:
Constant Field Values

TAG_Point

protected static final java.lang.String TAG_Point
See Also:
Constant Field Values

TAG_coordinates

protected static final java.lang.String TAG_coordinates
See Also:
Constant Field Values

ATTR_id

protected static final java.lang.String ATTR_id
See Also:
Constant Field Values

ATTR_Accuracy

protected static final java.lang.String ATTR_Accuracy
See Also:
Constant Field Values

URL_ReverseGeocode_

protected static final java.lang.String URL_ReverseGeocode_
See Also:
Constant Field Values

URL_Geocode_

protected static final java.lang.String URL_Geocode_
See Also:
Constant Field Values

PROP_reverseGeocodeURL

protected static final java.lang.String PROP_reverseGeocodeURL
See Also:
Constant Field Values

PROP_geocodeURL

protected static final java.lang.String PROP_geocodeURL
See Also:
Constant Field Values

PROP_sensor

protected static final java.lang.String PROP_sensor
See Also:
Constant Field Values

PROP_channel

protected static final java.lang.String PROP_channel
See Also:
Constant Field Values

PROP_countryCodeBias

protected static final java.lang.String PROP_countryCodeBias
See Also:
Constant Field Values

PROP_signatureKey

protected static final java.lang.String PROP_signatureKey
See Also:
Constant Field Values

TIMEOUT_ReverseGeocode

protected static final int TIMEOUT_ReverseGeocode
See Also:
Constant Field Values

TIMEOUT_Geocode

protected static final int TIMEOUT_Geocode
See Also:
Constant Field Values

DEFAULT_COUNTRY

protected static final java.lang.String DEFAULT_COUNTRY
See Also:
Constant Field Values

CLIENT_ID_PREFIX

protected static final java.lang.String CLIENT_ID_PREFIX
See Also:
Constant Field Values

FAILOVER_DEBUG

protected static final boolean FAILOVER_DEBUG
See Also:
Constant Field Values

MAX_ADDRESS_DISTANCE_KM

protected static final double MAX_ADDRESS_DISTANCE_KM
See Also:
Constant Field Values

ENCODING_UTF8

protected static final java.lang.String ENCODING_UTF8
See Also:
Constant Field Values
Constructor Detail

GoogleGeocodeV2

public GoogleGeocodeV2(java.lang.String name,
                       java.lang.String key,
                       RTProperties rtProps)
Method Detail

isFastOperation

public boolean isFastOperation()
Description copied from interface: ReverseGeocodeProvider
Returns true if this operation will take less than about 20ms to complete the returned value is used to determine whether the 'getReverseGeocode' operation should be performed immediately, or lazily (ie. in a separate thread).

Specified by:
isFastOperation in interface GeocodeProvider
Specified by:
isFastOperation in interface ReverseGeocodeProvider
Overrides:
isFastOperation in class ReverseGeocodeProviderAdapter
Returns:
True if this is a fast (ie. local) operation

getSignature

public GoogleSig getSignature()

getGeocodeTimeout

protected int getGeocodeTimeout()
Returns the Geocode timeout


getReverseGeocodeTimeout

protected int getReverseGeocodeTimeout()
Returns the ReverseGeocode timeout


getReverseGeocode

public ReverseGeocode getReverseGeocode(GeoPoint gp,
                                        java.lang.String localeStr,
                                        boolean cache)
Description copied from interface: ReverseGeocodeProvider
Returns the best address for the specified GeoPoint

Specified by:
getReverseGeocode in interface ReverseGeocodeProvider
Specified by:
getReverseGeocode in class ReverseGeocodeProviderAdapter
Returns:
The reverse-geocoded adress

getAddressReverseGeocodeURI

protected java.lang.String getAddressReverseGeocodeURI()

getAddressReverseGeocodeURL

protected java.lang.String getAddressReverseGeocodeURL(GeoPoint gp,
                                                       java.lang.String localStr)

getAddressReverseGeocode

public ReverseGeocode getAddressReverseGeocode(GeoPoint gp,
                                               java.lang.String localeStr,
                                               boolean cache)

getGeoPointGeocodeURI

protected java.lang.String getGeoPointGeocodeURI()

getGeoPointGeocodeURL

protected java.lang.String getGeoPointGeocodeURL(java.lang.String address,
                                                 java.lang.String country)

getGeocode

public GeoPoint getGeocode(java.lang.String address,
                           java.lang.String country)
Description copied from interface: GeocodeProvider
Returns GeoPoint of specified address

Specified by:
getGeocode in interface GeocodeProvider

GetXMLDocument

protected static org.w3c.dom.Document GetXMLDocument(java.lang.String url,
                                                     int timeoutMS)

GetNodeText

protected static java.lang.String GetNodeText(org.w3c.dom.Node root)

main

public static void main(java.lang.String[] argv)
Main entery point for debugging/testing