-
FEATURED COMPONENTS
First time here? Check out the FAQ!
i tried to run 2 examples(gglGeoWeb.war and zkGeoSample.war) in tomcat and glassfish, but they are not working. after i did a project in netbeans with source and appears java.lang.NullPointerException in the line:
GeoLatLng latlng = gresult.getResults().get(0).getGeometry().getLocation();
because
GeoResult gresult = gcoder.get(info);
found nothing.
my code:
public void locate() throws UnsupportedEncodingException{ GeoInfo info = new GeoInfo(); info.setAddress(tb.getValue()); Geocoder gcoder = new Geocoder(); GeoResult gresult = gcoder.get(info); /*According to Google Geocoding API, "results" contains an array of geocoded address information and geometry information, getResult will return array of result objects rather than single one.*/ GeoLatLng latlng = gresult.getResults().get(0).getGeometry().getLocation(); mymap.panTo(latlng.getLat(), latlng.getLng()); alert(gresult.getResults().get(0).getFormattedAddress()); }
are the 2 examples from this Small Talks?
http://books.zkoss.org/wiki/Small_Talks/2010/October/Google_Geo_Kit_With_Zk_Gmaps
If so, you may directly get contact with the author: [email protected]
Asked: 2012-01-04 19:59:38 +0800
Seen: 178 times
Last updated: Jan 10 '12