我正在尝试在我的 JSF 2.x 应用程序中使用 Gmaps4jsf 3.0.0 版。我想根据全球经纬度提取一些地方的地址。为此,我使用了以下代码:
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)