月球大数据地理空间分析展示平台-【后端】-月球后台服务
1
13693261870
2024-11-13 024e90554d19c2342f27a26f91bbea378f84da82
src/main/java/com/moon/server/helper/ShpHelper.java
@@ -15,16 +15,10 @@
import java.util.List;
import java.util.Map;
/**
 * ShapeFile帮助类
 * @author WWW
 */
@SuppressWarnings("ALL")
public class ShpHelper {
    private final static Log log = LogFactory.getLog(ShpHelper.class);
    /**
     * 读取Shp第一条记录的WKT
     */
    public static ShpRecordEntity readShpFirstRecord(String filePath) {
        Driver driver = null;
        DataSource dataSource = null;
@@ -60,9 +54,6 @@
        }
    }
    /**
     * 读取ShapeFile文件获取Mark实体类
     */
    public static List<MarkJsonEntity> readShpForMarks(String filePath) {
        Driver driver = null;
        DataSource dataSource = null;
@@ -94,9 +85,6 @@
        }
    }
    /**
     * 获取shp字段信息
     */
    private static Map<Integer, Field> getShpFields(Layer layer) {
        FeatureDefn featureDefn = layer.GetLayerDefn();
@@ -116,9 +104,6 @@
        return fields;
    }
    /**
     * 设置标绘实体类
     */
    private static List<MarkJsonEntity> setMarkJsonEntity(Layer layer, Map<Integer, Field> fieldMap) throws Exception {
        List<MarkJsonEntity> list = new ArrayList<>();
        for (int i = 0; i < layer.GetFeatureCount(); i++) {
@@ -137,14 +122,6 @@
        return list;
    }
    /**
     * 创建ShapeFile文件
     *
     * @param list 标绘JSON实体类集合
     * @param path 路径
     * @param type 类型:POINT,LINESTRING,POLYGON
     * @return ShapeFile文件名
     */
    public static String createShp(List<MarkJsonEntity> list, String path, String type) {
        Driver driver = null;
        DataSource dataSource = null;
@@ -162,11 +139,8 @@
                return null;
            }
            SpatialReference sr = new SpatialReference();
            sr.ImportFromEPSG(StaticData.I4326);
            int geoType = getGeometryType(type);
            layer = dataSource.CreateLayer(type.toLowerCase(), sr, geoType);
            layer = dataSource.CreateLayer(type.toLowerCase(), GeoHelper.sr104903, geoType);
            if (null == layer) {
                return null;
            }
@@ -195,9 +169,6 @@
        }
    }
    /**
     * 获取图形类型
     */
    private static int getGeometryType(String type) {
        switch (type) {
            case "POINT":
@@ -211,9 +182,6 @@
        }
    }
    /**
     * 读取数据
     */
    public static <T> List<T> readData(Class clazz, String filePath, boolean isTransform) {
        List<T> list = new ArrayList<>();