org.opengts.geocoder.google
Class GoogleGeocodeV3

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

public class GoogleGeocodeV3
extends ReverseGeocodeProviderAdapter
implements ReverseGeocodeProvider, GeocodeProvider


Field Summary
protected static java.lang.String CLIENT_ID_PREFIX
           
protected static java.lang.String DEFAULT_COUNTRY
           
protected static java.lang.String EMPTY_ADDRESS
           
protected static java.lang.String ENCODING_UTF8
           
protected static boolean FAILOVER_DEBUG
           
protected static JSON JSON_FORBIDDEN_403
           
protected static JSON JSON_LIMIT_EXCEEDED
           
protected static JSON JSON_NOT_FOUND_404
           
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 STATUS_FORBIDDEN_403
           
protected static java.lang.String STATUS_INVALID_REQUEST
           
protected static java.lang.String STATUS_LIMIT_EXCEEDED
           
protected static java.lang.String STATUS_NOT_FOUND_404
           
protected static java.lang.String STATUS_OK
           
protected static java.lang.String STATUS_OVER_QUERY_LIMIT
           
protected static java.lang.String STATUS_REQUEST_DENIED
           
protected static java.lang.String STATUS_ZERO_RESULTS
           
protected static java.lang.String TAG_address_components
           
protected static java.lang.String TAG_bounds
           
protected static java.lang.String TAG_formatted_address
           
protected static java.lang.String TAG_geometry
           
protected static java.lang.String TAG_lat
           
protected static java.lang.String TAG_lng
           
protected static java.lang.String TAG_location
           
protected static java.lang.String TAG_location_type
           
protected static java.lang.String TAG_long_name
           
protected static java.lang.String TAG_northeast
           
protected static java.lang.String TAG_results
           
protected static java.lang.String TAG_short_name
           
protected static java.lang.String TAG_southwest
           
protected static java.lang.String TAG_status
           
protected static java.lang.String TAG_types
           
protected static java.lang.String TAG_viewport
           
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
GoogleGeocodeV3(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 localeStr)
           
 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 JSON GetJSONDocument(java.lang.String url, int timeoutMS)
           
 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()
           
 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_results

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

TAG_status

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

TAG_address_components

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

TAG_long_name

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

TAG_short_name

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

TAG_types

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

TAG_formatted_address

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

TAG_geometry

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

TAG_bounds

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

TAG_northeast

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

TAG_southwest

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

TAG_lat

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

TAG_lng

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

TAG_location

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

TAG_location_type

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

TAG_viewport

protected static final java.lang.String TAG_viewport
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

EMPTY_ADDRESS

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

STATUS_OK

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

STATUS_ZERO_RESULTS

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

STATUS_OVER_QUERY_LIMIT

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

STATUS_LIMIT_EXCEEDED

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

STATUS_REQUEST_DENIED

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

STATUS_INVALID_REQUEST

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

STATUS_FORBIDDEN_403

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

STATUS_NOT_FOUND_404

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

JSON_LIMIT_EXCEEDED

protected static final JSON JSON_LIMIT_EXCEEDED

JSON_FORBIDDEN_403

protected static final JSON JSON_FORBIDDEN_403

JSON_NOT_FOUND_404

protected static final JSON JSON_NOT_FOUND_404

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

GoogleGeocodeV3

public GoogleGeocodeV3(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 localeStr)

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

GetJSONDocument

protected static JSON GetJSONDocument(java.lang.String url,
                                      int timeoutMS)

main

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