| | |
| | | public static String inverseGeographicalAnalysis(String lon, String lat, boolean poi){ |
| | | HttpRequest get = HttpUtil.createGet("https://apis.map.qq.com/ws/geocoder/v1/?location=" + lat + "," + lon + "&key=" + key + "&get_poi=" + (poi ? 1 : 0)); |
| | | HttpResponse execute = get.execute(); |
| | | log.info("经纬度转行政区:{}", execute.body()); |
| | | JSONObject jsonObject = JSON.parseObject(execute.body()); |
| | | Integer status = jsonObject.getInteger("status"); |
| | | if(0 != status){ |
| | | log.error(jsonObject.getString("message")); |
| | | return null; |
| | | throw new RuntimeException(jsonObject.getString("message")); |
| | | } |
| | | JSONObject result = jsonObject.getJSONObject("result"); |
| | | JSONObject ad_info = result.getJSONObject("ad_info"); |