|  |  | 
 |  |  |  */ | 
 |  |  | public class PositionUtil { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     public static String getTxMapAddrByLatAndLng(Double lat,Double lng,String host,String mapkey){ | 
 |  |  |         try { | 
 |  |  |             if(lat == null || lng ==null){ | 
 |  |  | 
 |  |  |            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"); | 
 |  |  |                    r =jsonObject.getJSONObject("result").getJSONObject("formatted_addresses").getString("recommend"); | 
 |  |  |                } | 
 |  |  |                if(r!=null && !r.equals("")){ | 
 |  |  |                if(r==null || r.equals("")){ | 
 |  |  |                    r =jsonObject.getJSONObject("result").getString("address"); | 
 |  |  |                } | 
 |  |  |            } | 
 |  |  | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  |     public static void main(String[] args) { | 
 |  |  |         String str ="[{\"lat\":31.732726766273103,\"lng\":117.37721605116087,\"height\":0},{\"lat\":31.72079687406289,\"lng\":117.39831914258241,\"height\":0},{\"lat\":31.714484720597493,\"lng\":117.39831914258241,\"height\":0},{\"lat\":31.71233192243245,\"lng\":117.39583137996954,\"height\":0},{\"lat\":31.71401037878662,\"lng\":117.3785457182995,\"height\":0}]"; | 
 |  |  |         TypeReference typeReference =  new TypeReference<List<LocaltionDTO>>(){}; | 
 |  |  |         List<LocaltionDTO> array = JSONObject.parseObject(str, typeReference.getType()); | 
 |  |  |         if(array == null || array.size() ==0){ | 
 |  |  |            System.out.println("================="); | 
 |  |  |         } | 
 |  |  |         System.out.println(isInPolygon(  117.39387876,31.71365546,array)); | 
 |  |  | //        System.out.println( | 
 |  |  | //          PositionUtil.getTxMapAddrByLatAndLng(Double.valueOf("31.76792509"),Double.valueOf("117.23267758"),"https://apis.map.qq.com","3AYBZ-I5R3V-2BVP3-UWBDQ-ETBM5-B2BBQ") | 
 |  |  | //        ); | 
 |  |  |  | 
 |  |  | //        String str ="[{\"lat\":31.732726766273103,\"lng\":117.37721605116087,\"height\":0},{\"lat\":31.72079687406289,\"lng\":117.39831914258241,\"height\":0},{\"lat\":31.714484720597493,\"lng\":117.39831914258241,\"height\":0},{\"lat\":31.71233192243245,\"lng\":117.39583137996954,\"height\":0},{\"lat\":31.71401037878662,\"lng\":117.3785457182995,\"height\":0}]"; | 
 |  |  | //        TypeReference typeReference =  new TypeReference<List<LocaltionDTO>>(){}; | 
 |  |  | //        List<LocaltionDTO> array = JSONObject.parseObject(str, typeReference.getType()); | 
 |  |  | //        if(array == null || array.size() ==0){ | 
 |  |  | //           System.out.println("================="); | 
 |  |  | //        } | 
 |  |  | //        System.out.println(isInPolygon(  117.39387876,31.71365546,array)); | 
 |  |  | //        AMap aMap = transform( 117.38823300,  31.71550000); | 
 |  |  | //        System.out.println(aMap.getLatitude()+""+aMap.getLongitude()); | 
 |  |  | //        System.out.println(isInPolygon(  aMap.getLongitude(),aMap.getLatitude(),array)); |