@Test public void testGoogleLookupSuccess() throws Exception { if (shouldRun()) { Geocoder geocoder = new GoogleMapsGeocoder(); final GWTLatLng remote = geocoder.geocode("220 Chatham Business Dr, Pittsboro, NC 27312"); final GWTLatLng local = new GWTLatLng(35.717372, -79.161857); assertEquals(local.hashCode(), remote.hashCode()); assertEquals(local, remote); } }
public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } GoogleMapsGeocoder(); }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } GoogleMapsGeocoder(); GWTLatLng geocode(String geolocation); }
GoogleMapsGeocoder implements Geocoder { public GWTLatLng geocode(String geolocation) throws GeocoderException { try { List<GeoAddress> addresses = m_standardizer.standardizeToGeoAddresses(geolocation); if (addresses.size() > 0) { if (addresses.size() > 1) { LogUtils.warnf(this, "received more than one address for geolocation '%s', returning the first", geolocation); } return getLatLng(addresses.get(0).getCoordinate()); } throw new GeocoderException("unable to find latitude/longitude for geolocation '" + geolocation + "'"); } catch (Throwable e) { LogUtils.infof(this, e, "unable to convert geolocation '%s'", geolocation); throw new GeocoderException(e); } } GoogleMapsGeocoder(); GWTLatLng geocode(String geolocation);  }