0

I'm trying to use Gmaps4jsf version 3.0.0 in my JSF 2.x application. I want to extract addressess of some places according to global latitude and longitude. To do that I used the following piece of code:

public static String addressGenerator(Double latitude, Double longitude){
    String address = "";
    try{
        address = GMaps4JSFServiceFactory.getReverseGeocoderService().
                getPlaceMark(latitude.toString(), longitude.toString()).getAddress();
        address = new String(address.getBytes(), "UTF-8");      
    } catch (Exception e){
        e.printStackTrace();
    }
    return address;
}

However, it didn't work and I encountered the following error:

java.lang.Exception: Error: Server returned HTTP response code: 403 for URL: http://maps.google.com/maps/geo?q=41.13087,28.974647&output=json&sensor=false&key=abcdef

at com.googlecode.gmaps4jsf.services.ReverseGeocoderServiceImpl.getPlaceMark(ReverseGeocoderServiceImpl.java:73)
nudastack
  • 155
  • 1
  • 5
  • 18

1 Answers1

0

I hit the same problem and I'm sure many others also did!

As per Google's documentation on this API: "Version 2 ("v2") of the Geocoding API was officially deprecated on 8 March 2010 and has now been turned down. As of 9 September 2013 the v2 API will no longer work."

See https://developers.google.com/maps/articles/geocodingupgrade on how to upgrade to version 3

Hope this helps :)