Sfoglia il codice sorgente

增加geo查询工具类

xiewj 1 anno fa
parent
commit
dacb0d0fe3

+ 25 - 0
4dkankan-utils-geo-query/src/main/java/com/fdkankan/geo/GeoQueryUtil.java

@@ -118,10 +118,35 @@ public class GeoQueryUtil {
             return false;
         }
     }
+    public AreaCityQuery.QueryResult queryPointInfo(String location)  {
+        String[] split = location.split(",");
+        if (split.length<2){
+            throw new RuntimeException("非法地理坐标");
+        }
+        double lng= Double.parseDouble(split[0]);
+        double lat= Double.parseDouble(split[1]);
+        AreaCityQuery.QueryResult res1= null;
+        try {
+            res1 = AreaCityQuery.QueryPoint(lng, lat, null, null);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return res1;
+    }
+    public AreaCityQuery.QueryResult queryPointInfo(Double lng,Double lat)  {
+        AreaCityQuery.QueryResult res1= null;
+        try {
+            res1 = AreaCityQuery.QueryPoint(lng, lat, null, null);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return res1;
+    }
 
     public static void main(String[] args) throws Exception {
         GeoQueryUtil queryUtil  = new GeoQueryUtil();
         System.out.println( queryUtil.queryPoint("109.47237681083061,30.265446034566555"));
         System.out.println( queryUtil. queryPoint("134.345421050937,34.090524661738"));
+        System.out.println( queryUtil. queryPoint("134.345421050937,34.090524661738"));
     }
 }