13693261870
2024-09-26 522eec01c681024740c4a584b4d57286832ee726
添加 管网集水点 数据
已修改3个文件
34 ■■■■■ 文件已修改
src/main/java/com/se/simu/domain/dto/GeLayer.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/helper/ShpHelper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/service/GedbService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/se/simu/domain/dto/GeLayer.java
@@ -37,6 +37,16 @@
        this.name = name;
    }
    public GeLayer(GeLayer layer,JSONArray data) {
        this.id = layer.getId();
        this.name = layer.getName();
        this.queryType = layer.getQueryType();
        this.fields = layer.getFields();
        this.shpName = layer.getShpName();
        this.db = layer.getDb();
        this.data = data;
    }
    public GeLayer(String id, String name, String queryType, List<GeField> fields, String shpName, GeDb db) {
        this();
        this.id = id;
src/main/java/com/se/simu/helper/ShpHelper.java
@@ -27,8 +27,7 @@
    public static Vector<String> getOptions() {
        if (null == options) {
            options = new Vector<>();
            //options.add("ENCODING=UTF-8");
            options.add("ENCODING=GBK");
            options.add("ENCODING=UTF-8");
        }
        return options;
src/main/java/com/se/simu/service/GedbService.java
@@ -18,7 +18,6 @@
import org.gdal.gdal.WarpOptions;
import org.gdal.gdal.gdal;
import org.gdal.gdalconst.gdalconst;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.client.RestTemplate;
@@ -226,9 +225,29 @@
            if (!ShpHelper.createShp(path, layer)) {
                throw new Exception(layer.getName() + ",创建ShapeFile文件失败!");
            }
            // 管网集水点
            if (layer.getShpName().equals(config.getShpNames().get(0))) {
                GeLayer juncLayer = new GeLayer(layer, filterLayerData(layer.getData()));
                if (!ShpHelper.createShp(basePath + File.separator + config.getJunctionName(), juncLayer)) {
                    throw new Exception("集水点" + ",创建ShapeFile文件失败!");
                }
            }
        }
    }
    private JSONArray filterLayerData(JSONArray data) {
        JSONArray arr = new JSONArray();
        String[] strs = config.getJunctionFilter().split("=");
        for (int i = 0, c = data.size(); i < c; i++) {
            JSONObject obj = data.getJSONObject(i).getJSONObject("properties");
            if (strs[1].equals(obj.getStr(strs[0]))) {
                arr.put(data.getJSONObject(i));
            }
        }
        return arr;
    }
    public void copeDem(String token, DataPo data) throws Exception {
        GeDb fileDb = getFileDb(token);
        String fileId = getFileId(token, fileDb.getDbid());