From 560a36b86d97fbb2dc7cc98966944d21ec299ca0 Mon Sep 17 00:00:00 2001
From: rain <167982779@qq.com>
Date: Wed, 27 Mar 2024 09:55:36 +0800
Subject: [PATCH] 图斑
---
src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 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 b1325f4..bbe43bd 100644
--- a/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
+++ b/src/main/java/com/dji/sample/patches/utils/ShapeFileUtil.java
@@ -54,10 +54,11 @@
Filter filter = Filter.INCLUDE;
FeatureCollection<SimpleFeatureType, SimpleFeature> collection = source.getFeatures(filter);
return collection;
- }catch (Exception e){
+ } catch (Exception e) {
throw e;
}
}
+
/**
* @param zipFile:
* @return JSONObject
@@ -67,15 +68,15 @@
*/
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<>();
+ JSONObject geoJsonObject = new JSONObject();
+ geoJsonObject.put("type", "FeatureCollection");
+ List<String> strings = new ArrayList<>();
try {
// 获取FeatureCollection
FeatureCollection collection = getFeatureCollectionByShpFile(zipFile);
FeatureIterator iterator = collection.features();
- List<JSONObject> array = new ArrayList<JSONObject>();
+ List<JSONObject> array = new ArrayList<JSONObject>();
//遍历feature转为json对象
while (iterator.hasNext()) {
SimpleFeature feature = (SimpleFeature) iterator.next();
@@ -91,10 +92,10 @@
}
iterator.close();
//添加到geojsonObject
- geoJsonObject.put("features",array);
+ geoJsonObject.put("features", array);
iterator.close();
- }catch (Exception e){
+ } catch (Exception e) {
throw e;
}
return strings;
--
Gitblit v1.9.3