Gmaps4jsf V3.0.0在尝试反向地理编码时出现HTTP错误
我试图在我的JSF2.x应用程序中使用Gmaps4jsf版本3.0.0。我想根据全球纬度和经度提取一些地方的地址。为此,我使用了以下代码:Gmaps4jsf V3.0.0在尝试反向地理编码时出现HTTP错误,http,jsf-2.2,gmaps4jsf,Http,Jsf 2.2,Gmaps4jsf,我试图在我的JSF2.x应用程序中使用Gmaps4jsf版本3.0.0。我想根据全球纬度和经度提取一些地方的地址。为此,我使用了以下代码: public static String addressGenerator(Double latitude, Double longitude){ String address = ""; try{ address = GMaps4JSFServiceFactory.getReverseGeocoderService().
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)
我遇到了同样的问题,我相信很多其他人也遇到了 根据谷歌关于此API的文档: “地理编码API的第2版(“v2”)于2010年3月8日被正式弃用,现已被拒绝。截至2013年9月9日,v2 API将不再工作。” 有关如何升级到版本3的信息,请参见 希望这有帮助:)