| | |
| | | package com.doumee.core.utils; |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.doumee.dao.business.web.request.LocaltionDTO; |
| | | |
| | | import java.awt.geom.GeneralPath; |
| | |
| | | * 计算距离 |
| | | */ |
| | | public class PositionUtil { |
| | | public static String getTxMapAddrByLatAndLng(Double lat,Double lng,String host,String mapkey){ |
| | | try { |
| | | if(lat == null || lng ==null){ |
| | | return null; |
| | | } |
| | | String url =host +"/ws/geocoder/v1/?key="+mapkey+"&location="+lat+","+lng; |
| | | String res = HttpsUtil.get(url,false); |
| | | JSONObject jsonObject = JSONObject.parseObject(res ); |
| | | String r = null; |
| | | if(jsonObject.getJSONObject("result")!=null){ |
| | | if(jsonObject.getJSONObject("result").getJSONObject("formatted_addresses")!=null){ |
| | | r =jsonObject.getJSONObject("result").getJSONObject("formatted_addresses").getString("formatted_addresses"); |
| | | } |
| | | if(r!=null && !r.equals("")){ |
| | | r =jsonObject.getJSONObject("result").getString("address"); |
| | | } |
| | | } |
| | | return r; |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 判断坐标点是否在多边形区域内 |
| | | * |