2013-07-23 24 views
0

我想在我的JSF 2.x应用程序中使用Gmaps4jsf版本3.0.0。我想根据全球经纬度提取一些地方的地理位置。要做到这一点我用下面的代码:Gmaps4jsf V3.0.0在尝试反向地理编码时给出HTTP错误

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

但是,它没有工作,我遇到了以下错误:

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) 

回答

0

我打了同样的问题,我相信很多别人也做到了!

根据Google关于此API的文档: “Geocoding API的第2版(”v2“)于2010年3月8日正式弃用,现在已被拒绝。截至2013年9月9日,v2 API将不再工作。”

https://developers.google.com/maps/articles/geocodingupgrade如何升级到版本3

希望这有助于:)

相关问题