From 0de01eba0bde756a1c4fec13615fe92b2cf51db3 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Mon, 25 Mar 2024 18:46:39 +0800
Subject: [PATCH] 图斑

---
 src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java b/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
index 72df6b3..b1325f4 100644
--- a/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
@@ -65,10 +65,11 @@
      * @description 通过shp压缩文件,将其转换为GeoJson格式
      * @date 2023/7/18 16:04
      */
-    public static JSONObject shpToGeoJson(File zipFile) throws IOException {
+    public static List<String> shpToGeoJson(File zipFile) throws IOException {
         FeatureJSON fjson = new FeatureJSON();
         JSONObject geoJsonObject=new JSONObject();
         geoJsonObject.put("type","FeatureCollection");
+        List<String> strings=new ArrayList<>();
         try {
             // 获取FeatureCollection
             FeatureCollection collection = getFeatureCollectionByShpFile(zipFile);
@@ -84,6 +85,8 @@
                 byte[] b = temp.getBytes("iso8859-1");
                 temp = new String(b, "gbk");
                 JSONObject json = JSONObject.parseObject(temp);
+                String str2 = json.getJSONObject("geometry").get("coordinates").toString();
+                strings.add(str2);
                 array.add(json);
             }
             iterator.close();
@@ -94,7 +97,7 @@
         }catch (Exception e){
             throw e;
         }
-        return geoJsonObject;
+        return strings;
     }
 
 }

--
Gitblit v1.9.3