腾讯地图如何根据经纬度获取地址
/**
* //GET请求
*
* lat<纬度>,lng<经度>
*/
@GetMapping("tencentGetLonAndLat/{lat}/{lng}")
public RestResponse tencentGetLonAndLat(@PathVariable String lat, @PathVariable String lng) {
String url = "https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lng + "&key=xxxxx-V3MRZ-5IBUP";
//链式构建请求
String body = HttpRequest.get(url)
.timeout(10000)//超时,毫秒
.execute().body();
VoTentCent voTentCent = JSONUtil.toBean(body, VoTentCent.class);
Console.log(voTentCent);
return RestResponse.success(voTentCent);
}
key填写自己申请的key即可