From 3afaf1a21f47b6f9b46dd8e089e15e1e325c810a Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Wed, 10 Jul 2024 15:44:51 +0800
Subject: [PATCH] 更新喇叭,图斑解析更新
---
src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java | 19 +++++++++++++++++--
1 files changed, 17 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 baeb13d..facbe82 100644
--- a/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
@@ -2,6 +2,7 @@
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSONObject;
+import com.dji.sample.patches.model.dto.ShpDTO;
import org.geotools.data.DataStore;
import org.geotools.data.DataStoreFinder;
import org.geotools.data.FeatureSource;
@@ -58,7 +59,9 @@
* @description 通过shp压缩文件,将其转换为GeoJson格式
*/
//将解压后的文件转换成GeoJson格式
- public static List<String> shpToGeoJson(File zipFile) throws IOException {
+ public static List<ShpDTO> shpToGeoJson(File zipFile) throws IOException {
+ ShpDTO shpDTO=new ShpDTO();
+ List<ShpDTO> dtoList= new ArrayList<>();
FeatureJSON fjson = new FeatureJSON();
JSONObject geoJsonObject = new JSONObject();
geoJsonObject.put("type", "FeatureCollection");
@@ -78,6 +81,18 @@
byte[] b = temp.getBytes("iso8859-1");
temp = new String(b, "gbk");
JSONObject json = JSONObject.parseObject(temp);
+ shpDTO.setDKFW(json.getJSONObject("geometry").get("coordinates").toString());
+ shpDTO.setGEO(json.getJSONObject("geometry").get("type").toString());
+ shpDTO.setXZQDM(json.getJSONObject("properties").get("XZQDM").toString());
+ shpDTO.setXZB( json.getJSONObject("properties").getDouble("XZB"));
+ shpDTO.setYZB( json.getJSONObject("properties").getDouble("YZB"));
+ shpDTO.setDKBH(json.getJSONObject("properties").get("JCBH").toString());
+ shpDTO.setJCMJ(json.getJSONObject("properties").getDouble("JCMC"));
+ shpDTO.setTBLX(json.getJSONObject("properties").getString("TBLX"));
+ shpDTO.setDDTC(json.getJSONObject("properties").getString("DDTC"));
+ shpDTO.setHSX(json.getJSONObject("properties").getString("HSX"));
+ shpDTO.setJCLX(json.getJSONObject("properties").getString("JCLX"));
+ dtoList.add(shpDTO);
String str2 = json.getJSONObject("geometry").get("coordinates").toString();
strings.add(str2);
array.add(json);
@@ -90,7 +105,7 @@
} catch (Exception e) {
throw e;
}
- return strings;
+ return dtoList;
}
}
--
Gitblit v1.9.3