فهرست منبع

增加geo查询工具类

xiewj 1 سال پیش
والد
کامیت
9c3b5dd95f
1فایلهای تغییر یافته به همراه14 افزوده شده و 4 حذف شده
  1. 14 4
      4dkankan-utils-geo-query/src/main/java/com/fdkankan/geo/GeoQueryUtil.java

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

@@ -82,14 +82,19 @@ public class GeoQueryUtil {
         AreaCityQuery.Init_StoreInWkbsFile(dataFilePath, saveWkbsFilePath, true);
         System.out.println(AreaCityQuery.GetInitInfo().toString()); //打印初始化详细信息,包括性能信息
     }
-   public boolean queryPoint(String location) throws Exception {
+   public boolean queryPoint(String location)  {
        String[] split = location.split(",");
        if (split.length<2){
            return false;
        }
        double lng= Double.parseDouble(split[0]);
        double lat= Double.parseDouble(split[1]);
-       AreaCityQuery.QueryResult res1=AreaCityQuery.QueryPoint(lng, lat, null, null);
+       AreaCityQuery.QueryResult res1= null;
+       try {
+           res1 = AreaCityQuery.QueryPoint(lng, lat, null, null);
+       } catch (Exception e) {
+           throw new RuntimeException(e);
+       }
        if (res1!=null &&res1.Result.size()>0){
            log.info("查询结果:{},{}",true,res1);
            return true;
@@ -98,8 +103,13 @@ public class GeoQueryUtil {
            return false;
        }
     }
-    public boolean queryPoint(Double lng,Double lat) throws Exception {
-        AreaCityQuery.QueryResult res1=AreaCityQuery.QueryPoint(lng, lat, null, null);
+    public boolean queryPoint(Double lng,Double lat)  {
+        AreaCityQuery.QueryResult res1= null;
+        try {
+            res1 = AreaCityQuery.QueryPoint(lng, lat, null, null);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
         if (res1!=null &&res1.Result.size()>0){
             log.info("查询结果:{},{}",true,res1);
             return true;