rain
2024-03-27 87e29ab2ace5aa1ff5484a631ace13e50344ddc8
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;
    }
}