@Value("${lbs.amap-web-key}")
private String key;
protected String getAddress(double longitude, double latitude) throws Exception {
if ((longitude == 0.0D) && (latitude == 0.0D)) {
return "";
}
String url = "https://restapi.amap.com/v3/geocode/regeo?output=json&location=" + longitude + "," + latitude + "&key=" + key + "&radius=1000&extensions=all&batch=false&roadlevel=0";
MapResult mapResult = (MapResult) this.restTemplate.getForObject(url, MapResult.class, new Object[0]);
if (mapResult == null) return "";
return mapResult.getRegeocode() != null ? mapResult.getRegeocode().getFormatted_address() : "";
}
lbs.amap-web-key=88ce89f3a4c4aa921e640cf3b659d555