0

about Google Geo Kit in Java

asked 2012-01-04 19:59:38 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

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());       
        }

thanks in advance.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-01-10 01:40:19 +0800

paowang gravatar image paowang
140 6

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]

link publish delete flag offensive edit

answered 2012-01-10 19:29:30 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

Ok, thanks for reply

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-01-04 19:59:38 +0800

Seen: 178 times

Last updated: Jan 10 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More