Преглед на файлове

套合分析生成导出相关接口提交

wanger преди 5 месеца
родител
ревизия
43d4fb19bc
променени са 18 файла, в които са добавени 908 реда и са изтрити 614 реда
  1. 26 0
      onemap-modules/onemap-overlap/pom.xml
  2. 47 2
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/controller/DataController.java
  3. 9 3
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/service/DataService.java
  4. 223 10
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/service/impl/DataImp.java
  5. 288 0
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/AchievementPackage.java
  6. 173 0
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/GeoServer.java
  7. 0 52
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/GeoServerSpatialiteJDBC.java
  8. 0 121
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/GeoToolsSpatialOverlay.java
  9. 0 24
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/LoadShapefile.java
  10. 0 35
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/OverlayAnalysis.java
  11. 0 150
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShapefileOverlayAnalysis.java
  12. 0 63
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShapefileToGeoPackage.java
  13. 0 96
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShapefileToSpatiaLiteWithProjection.java
  14. 31 0
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShpSridRetriever.java
  15. 100 0
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/SpatiaLiteToShapefile.java
  16. 0 56
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/SpatialiteSample.java
  17. 1 1
      onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/WebViewExample.java
  18. 10 1
      onemap-modules/onemap-overlap/src/main/resources/application.yml

+ 26 - 0
onemap-modules/onemap-overlap/pom.xml

@@ -95,6 +95,11 @@
         </dependency>
 
         <!--geotools-->
+<!--        <dependency>-->
+<!--            <groupId>org.geotools</groupId>-->
+<!--            <artifactId>gt-api</artifactId>-->
+<!--            <version>${org.geotools.version}</version>  &lt;!&ndash; 或使用适当版本 &ndash;&gt;-->
+<!--        </dependency>-->
         <dependency>
             <groupId>org.geotools</groupId>
             <artifactId>gt-main</artifactId>
@@ -180,6 +185,27 @@
             <artifactId>jai-core</artifactId>
             <version>1.1.3</version> <!-- 或者最新版本 -->
         </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>4.5.13</version> <!-- 版本可以根据需要调整 -->
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpcore</artifactId>
+            <version>4.4.13</version> <!-- 版本可以根据需要调整 -->
+        </dependency>
+        <dependency>
+            <groupId>org.codehaus.jackson</groupId>
+            <artifactId>jackson-core-asl</artifactId>
+            <version>1.9.13</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.8.9</version>
+        </dependency>
+
 
     </dependencies>
 

+ 47 - 2
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/controller/DataController.java

@@ -36,9 +36,9 @@ public class DataController {
      * @return
      */
     @PostMapping("/import")
-    public RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield) {
+    public RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield, String style) {
         try {
-            return dataService.importIn(file, path, type, name, ufield);
+            return dataService.importIn(file, path, type, name, ufield, style);
         } catch (Exception e) {
             e.printStackTrace();
             return RequestResult.error("失败", null);
@@ -166,6 +166,21 @@ public class DataController {
         }
     }
 
+    /**
+     * 删除指定分析套合数据
+     *
+     * @return
+     */
+    @RequestMapping("/analysevectordelete")
+    public RequestResult analysevectordelete(String tablename) {
+        try {
+            return dataService.analysevectordelete(tablename);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RequestResult.error("失败", null);
+        }
+    }
+
     @GetMapping("/{tiftype}/{tableid}/{uuid}.{filetype}")
     public ResponseEntity<InputStreamResource> getTiff(@PathVariable("tiftype") String tiftype, @PathVariable("tableid") String tableid, @PathVariable("uuid") String uuid, @PathVariable("filetype") String filetype) {
         return dataService.getTiff(tiftype, tableid, uuid, filetype);
@@ -246,6 +261,21 @@ public class DataController {
         }
     }
 
+    /**
+     * 获取地图样式集合
+     *
+     * @return
+     */
+    @RequestMapping("/getGeoServerStyles")
+    public RequestResult getGeoServerStyles() {
+        try {
+            return dataService.getGeoServerStyles();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RequestResult.error("失败", null);
+        }
+    }
+
     /**
      * 修改地图配置
      *
@@ -290,4 +320,19 @@ public class DataController {
             return RequestResult.error("失败", null);
         }
     }
+
+    /**
+     * 生成套合分析成果包
+     *
+     * @return
+     */
+    @RequestMapping("/exportAchievementPackage")
+    public RequestResult exportAchievementPackage(String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
+        try {
+            return dataService.exportAchievementPackage(tablename, layername, request, response);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RequestResult.error("失败", null);
+        }
+    }
 }

+ 9 - 3
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/service/DataService.java

@@ -10,7 +10,9 @@ import javax.servlet.http.HttpServletResponse;
 
 public interface DataService {
 
-    RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield);
+    void start();
+
+    RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield, String style);
 
     RequestResult modellist();
 
@@ -38,8 +40,6 @@ public interface DataService {
 
     RequestResult getTableRecord(String tablename, Integer page, Integer limit);
 
-    void start();
-
     RequestResult getMapConfig(String key);
 
     RequestResult updateMapConfig(HttpServletRequest request);
@@ -47,4 +47,10 @@ public interface DataService {
     RequestResult overlapAnalysis(String modelname, String tablename);
 
     RequestResult exportReport(String modelname, String tablename, String layername, HttpServletRequest request, HttpServletResponse response);
+
+    RequestResult getGeoServerStyles();
+
+    RequestResult analysevectordelete(String tablename);
+
+    RequestResult exportAchievementPackage(String tablename, String layername, HttpServletRequest request, HttpServletResponse response);
 }

+ 223 - 10
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/service/impl/DataImp.java

@@ -20,16 +20,17 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.awt.*;
 import java.io.*;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
+import java.nio.file.*;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.sql.*;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
 
 @Service
 public class DataImp implements DataService {
@@ -55,8 +56,19 @@ public class DataImp implements DataService {
     String qgis;
     @Value("${swid}")
     String swid;
+    @Value("${swarea}")
+    String swarea;
     @Value("${exportFields}")
     String exportFields;
+    @Value("${mapExport.fixed}")
+    String mapExportFixed;
+    @Value("${mapExport.size}")
+    Integer mapExportSize;
+    @Value("${checkedstyle}")
+    String checkedstyle;
+    @Value("${spotstyle}")
+    String spotstyle;
+
 
     @Override
     public void start() {
@@ -66,7 +78,10 @@ public class DataImp implements DataService {
     }
 
     @Override
-    public RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield) {
+    public RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield, String style) {
+        if (StringUtils.isEmpty(style)) {
+            style = spotstyle;
+        }
         if (file == null && path == null) {
             return RequestResult.error("参数未传递", null);
         }
@@ -151,17 +166,40 @@ public class DataImp implements DataService {
             Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
             Statement statement = connection.createStatement();
             //增加swid字段
-            String swidSql = "ALTER TABLE " + tablename + " ADD COLUMN swid TEXT";
+            String swidSql = "ALTER TABLE " + tablename + " ADD COLUMN " + swid + " TEXT";
             statement.execute(swidSql);
-            swidSql = "UPDATE " + tablename + " set swid = " + ufield;
+            swidSql = "UPDATE " + tablename + " set " + swid + " = " + ufield;
             statement.execute(swidSql);
-            //注册数据到属性表
+            //增加swarea字段
+            String swareaSql = "ALTER TABLE " + tablename + " ADD COLUMN " + swarea + "  TEXT";
+            statement.execute(swareaSql);
+            swareaSql = "UPDATE " + tablename + " set " + swarea + " = round(st_area(geom), 2)";
+            statement.execute(swareaSql);
+
+            //TODO wanger 发布到geoserver
+            File shp = new File(shpPath);
+            String fileName = shp.getName();
+            int dotIndex = fileName.lastIndexOf('.');
+            String datasource = dotIndex != -1 ? fileName.substring(0, dotIndex) : fileName;
+            String querySQL = "select uri , username , password, workspace from t_geoserver ";
+            ResultSet resultSet = statement.executeQuery(querySQL);
+            String geoserverurl = resultSet.getString("uri");
+            String geoserverusername = resultSet.getString("username");
+            String geoserverpassword = resultSet.getString("password");
+            String geoserverworkspace = resultSet.getString("workspace");
+            GeoServer.publishShp(geoserverurl, geoserverusername, geoserverpassword, geoserverworkspace, shpPath, style, datasource);
+            //注册数据到属性表 http://192.168.60.52:28085/geoserver/spot/wms spot:基本农田 EPSG:4525
+            String layerurl = geoserverurl + "/" + geoserverworkspace + "/wms";
+            String layername = geoserverworkspace + ":" + datasource;
+            String epsg = GeoServer.getShpEPSG(shpPath);
             String insertSQL = "";
             if ("base".equals(type)) {//管控数据
-                insertSQL = "insert into t_base_vector (layername , tablename) values ('" + name + "', '" + tablename + "')";
+                insertSQL = "insert into t_base_vector (layername , tablename, serviceuri , servicetype, servicename, serviceproj) values ('" + name + "', '" + tablename + "', " +
+                        "'" + layerurl + "', 'WMS', '" + layername + "', '" + epsg + "')";
             } else if ("analyse".equals(type)) {//分析图斑
 //                resourcesConfig.publishResourceMappingEvent(tablename, folderpath);
-                insertSQL = "insert into t_analyse_vector (layername , tablename, path) values ('" + name + "', '" + tablename + "', '" + folderpath + "')";
+                insertSQL = "insert into t_analyse_vector (layername , tablename, path, serviceuri , servicetype, servicename, serviceproj) values ('" + name + "', '" + tablename + "', '" + folderpath + "'," +
+                        "'" + layerurl + "', 'WMS', '" + layername + "', '" + epsg + "')";
             }
             statement.execute(insertSQL);
             connection.close();
@@ -293,6 +331,27 @@ public class DataImp implements DataService {
         return RequestResult.error("失败!", null);
     }
 
+    @Override
+    public RequestResult analysevectordelete(String tablename) {
+        try {
+            Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
+            Statement statement = connection.createStatement();
+            //删除主表
+            String deleteSQL = "delete from t_analyse_vector where tablename = '" + tablename + "'";
+            statement.execute(deleteSQL);
+            //删除矢量表
+            deleteSQL = "drop table " + tablename + "";
+            statement.execute(deleteSQL);
+            deleteSQL = "delete from geometry_columns where f_table_name = '" + tablename + "'";
+            statement.execute(deleteSQL);
+            connection.close();
+            return RequestResult.success("删除成功!", 1);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("失败!", null);
+    }
+
     @Override
     public RequestResult getShpFields(String path) {
         List<String> fields = ShpToSpatiaLite.getShpFields(path);
@@ -532,6 +591,10 @@ public class DataImp implements DataService {
                 cur.put("fxjssj", resultSet.getString("fxjssj"));
                 cur.put("fxrz", resultSet.getString("fxrz"));
                 cur.put("fxmodel", resultSet.getString("fxmodel"));
+                cur.put("serviceuri", resultSet.getString("serviceuri"));
+                cur.put("servicetype", resultSet.getString("servicetype"));
+                cur.put("servicename", resultSet.getString("servicename"));
+                cur.put("serviceproj", resultSet.getString("serviceproj"));
                 res.add(cur);
             }
             connection.close();
@@ -564,6 +627,24 @@ public class DataImp implements DataService {
         return RequestResult.error("查询失败!", null);
     }
 
+    @Override
+    public RequestResult getGeoServerStyles() {
+        try {
+            Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
+            Statement statement = connection.createStatement();
+            String querySQL = "select uri , username , password, workspace from t_geoserver ";
+            ResultSet resultSet = statement.executeQuery(querySQL);
+            List<String> styles = GeoServer.getStyles(resultSet.getString("uri"), resultSet.getString("username"),
+                    resultSet.getString("password"), resultSet.getString("workspace"));
+            System.out.println(styles);
+            connection.close();
+            return RequestResult.success("查询成功!", styles);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return RequestResult.error("查询失败!", null);
+    }
+
     @Override
     public RequestResult updateMapConfig(HttpServletRequest request) {
         try {
@@ -681,6 +762,22 @@ public class DataImp implements DataService {
             // 修改数据的分析状态和结束时间
             updateSql = "update t_analyse_vector set fxzt = '2' , fxjssj = CURRENT_TIMESTAMP, fxrz = '分析正常结束' where tablename = '" + tablename + "'";
             statement.execute(updateSql);
+
+            //TODO 更新geoserver样式 为checkedstyle
+            querySQL = "select servicename  from t_analyse_vector t where tablename = '" + tablename + "'";
+            resultSet = statement.executeQuery(querySQL);
+            String datasource = resultSet.getString("servicename");
+            querySQL = "select uri , username , password, workspace from t_geoserver ";
+            resultSet = statement.executeQuery(querySQL);
+            String geoserverurl = resultSet.getString("uri");
+            String geoserverusername = resultSet.getString("username");
+            String geoserverpassword = resultSet.getString("password");
+            String geoserverworkspace = resultSet.getString("workspace");
+            GeoServer.updateStyle(checkedstyle, geoserverurl, geoserverusername, geoserverpassword, datasource);
+
+            resultSet.close();
+            statement.close();
+            connection.close();
             return RequestResult.success("分析完成!", 1);
         } catch (Exception e) {
             e.printStackTrace();
@@ -720,6 +817,55 @@ public class DataImp implements DataService {
         return RequestResult.success("导出成功", 1);
     }
 
+    @Override
+    public RequestResult exportAchievementPackage(String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
+        String folderPath = localFilePath + "" + layername + "\\" + "package";
+        String zippath = localFilePath + "" + layername + "\\package.zip";
+        File folder = new File(folderPath);
+        if (!folder.exists()) {
+            folder.mkdirs();
+        }
+        if (Files.exists(Paths.get(zippath))) {
+            // TODO 系统打开文件夹
+            try {
+                Runtime.getRuntime().exec("explorer.exe " + folderPath);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            return RequestResult.success("导出成功", 1);
+        }
+        String excelpath = folderPath + "/" + layername + ".xlsx";
+        String shppath = folderPath + "/" + layername + ".shp";
+        try {
+            Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
+            Statement statement = connection.createStatement();
+            ResultSet resultSet = statement.executeQuery("select * from t_geoserver ");
+            String geoserverurl = "";
+            while (resultSet.next()) {
+                geoserverurl = resultSet.getString("uri") + "/" + resultSet.getString("workspace") + "/wms";
+            }
+            resultSet = statement.executeQuery("select path from t_analyse_vector t where tablename = '" + tablename + "' ");
+            String analysefolder = "";
+            while (resultSet.next()) {
+                analysefolder = resultSet.getString("path");
+            }
+            resultSet.close();
+            statement.close();
+            connection.close();
+            copyDirectory(Paths.get(analysefolder + "/" + qsx), Paths.get(folderPath + "/" + qsx));
+            copyDirectory(Paths.get(analysefolder + "/" + hsx), Paths.get(folderPath + "/" + hsx));
+            SpatiaLiteToShapefile.execute(dbpath, shppath, shpWkid, tablename);
+            AchievementPackage.exportAttributes(tablename, excelpath, dbpath, "EPSG:" + shpWkid, mapExportFixed, mapExportSize, geoserverurl);
+            zipDirectory(folderPath, zippath);
+            // TODO 系统打开文件夹
+            Runtime.getRuntime().exec("explorer.exe " + folderPath);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return RequestResult.error("导出失败", e.toString());
+        }
+        return RequestResult.success("导出成功", 1);
+    }
+
     // 运行cmd
     public String ExecuteCMD(String command) {
         String res = "";
@@ -741,6 +887,73 @@ public class DataImp implements DataService {
         return res;
     }
 
+    public static void zipDirectory(String sourceDir, String zipFilePath) throws IOException {
+        Path sourcePath = Paths.get(sourceDir);
+        try (FileOutputStream fos = new FileOutputStream(zipFilePath);
+             ZipOutputStream zos = new ZipOutputStream(fos)) {
+
+            // 递归遍历目录
+            Files.walk(sourcePath).forEach(path -> {
+                // 计算文件或目录的相对路径
+                Path relativePath = sourcePath.relativize(path);
+                // 确保目录也被加入到ZIP文件中
+                if (Files.isDirectory(path)) {
+                    try {
+                        // 如果是目录,直接创建一个目录条目
+                        zos.putNextEntry(new ZipEntry(relativePath.toString().replace("\\", "/") + "/"));
+                        zos.closeEntry();  // 必须调用closeEntry(),即使只是目录
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                } else {
+                    try (InputStream is = Files.newInputStream(path)) {
+                        // 如果是文件,则创建文件条目
+                        ZipEntry zipEntry = new ZipEntry(relativePath.toString().replace("\\", "/"));
+                        zos.putNextEntry(zipEntry);
+
+                        // 写入文件内容
+                        byte[] buffer = new byte[1024];
+                        int length;
+                        while ((length = is.read(buffer)) > 0) {
+                            zos.write(buffer, 0, length);
+                        }
+                        zos.closeEntry();
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+            });
+        }
+    }
+
+    // 递归拷贝文件夹及其内容
+    public void copyDirectory(Path sourceDir, Path targetDir) throws IOException {
+        // 如果目标目录不存在,创建目标目录
+        if (Files.notExists(targetDir)) {
+            Files.createDirectories(targetDir);
+        }
+
+        // 遍历源目录的内容,并拷贝到目标目录
+        Files.walkFileTree(sourceDir, new SimpleFileVisitor<Path>() {
+            @Override
+            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+                // 计算目标文件路径
+                Path targetFile = targetDir.resolve(sourceDir.relativize(file));
+                // 拷贝文件到目标目录,覆盖已存在的文件
+                Files.copy(file, targetFile, StandardCopyOption.REPLACE_EXISTING);
+                return FileVisitResult.CONTINUE;
+            }
+
+            @Override
+            public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
+                // 拷贝完目录内容后,拷贝该目录
+                Path targetDirForCurrentDir = targetDir.resolve(sourceDir.relativize(dir));
+                Files.createDirectories(targetDirForCurrentDir);
+                return FileVisitResult.CONTINUE;
+            }
+        });
+    }
+
     // 将ResultSet转换为List<Map<String, Object>>
     public List<Map<String, Object>> resultSetToMap(ResultSet rs) throws Exception {
         List<Map<String, Object>> resultList = new ArrayList<>();

+ 288 - 0
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/AchievementPackage.java

@@ -0,0 +1,288 @@
+package com.onemap.overlap.utils;
+
+import com.onemap.common.core.utils.StringUtils;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.xwpf.usermodel.*;
+import org.apache.poi.ss.usermodel.*;
+import org.apache.xmlbeans.XmlCursor;
+import org.locationtech.jts.geom.Geometry;
+import org.locationtech.jts.io.WKTReader;
+import org.opengis.feature.simple.SimpleFeature;
+
+import java.io.*;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.sql.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class AchievementPackage {
+    public static class GeometryParams {
+        private String layername;
+        private String xmin;
+        private String xmax;
+        private String ymin;
+        private String ymax;
+        private String swid;
+
+        public String getLayername() {
+            return layername;
+        }
+
+        public void setLayername(String layername) {
+            this.layername = layername;
+        }
+
+        public String getXmin() {
+            return xmin;
+        }
+
+        public void setXmin(String xmin) {
+            this.xmin = xmin;
+        }
+
+        public String getXmax() {
+            return xmax;
+        }
+
+        public void setXmax(String xmax) {
+            this.xmax = xmax;
+        }
+
+        public String getYmin() {
+            return ymin;
+        }
+
+        public void setYmin(String ymin) {
+            this.ymin = ymin;
+        }
+
+        public String getYmax() {
+            return ymax;
+        }
+
+        public void setYmax(String ymax) {
+            this.ymax = ymax;
+        }
+
+        public String getSwid() {
+            return swid;
+        }
+
+        public void setSwid(String swid) {
+            this.swid = swid;
+        }
+    }
+
+    public static void main(String[] args) {
+        System.out.println("导出分析成果包开始");
+        exportAttributes("sw_wuchuan0705_20241226145657", "D:\\temp\\wuchuan0705\\package\\attributes.xlsx",
+                "D:\\temp\\mappatchcheck.sqlite", "EPSG:4525",
+                "height", 600, "http://localhost:28085/geoserver/spot/wms");
+        System.out.println("导出分析成果包结束");
+    }
+
+    /**
+     * 根据tablename 导出重叠的管控数据属性信息表
+     *
+     * @param tablename
+     * @param filepath
+     * @return
+     */
+    public static Boolean exportAttributes(String tablename, String filepath, String dbpath,
+                                           String proj, String fixed, Integer imageSize, String geoserverurl) {
+        try {
+            //TODO 根据表名查询分析模型的管控数据集合
+            Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
+            Statement statement = connection.createStatement();
+            ResultSet resultSet = statement.executeQuery("SELECT t.type, t.layername, b.tablename, b.servicename FROM t_model t " +
+                    "LEFT JOIN t_base_vector b ON b.layername = t.layername " +
+                    "WHERE t.modelname =  (select fxmodel from  t_analyse_vector v where tablename = '" + tablename + "') AND t.isvalid = '有效'  " +
+                    "ORDER BY t.layername");
+            List<Map<String, Object>> tables = new ArrayList<>();
+            while (resultSet.next()) {
+                Map<String, Object> cur = new HashMap<>();
+                cur.put("type", resultSet.getString("type"));
+                cur.put("layername", resultSet.getString("layername"));
+                cur.put("tablename", resultSet.getString("tablename"));
+                cur.put("servicename", resultSet.getString("servicename"));
+                tables.add(cur);
+            }
+
+            //TODO 查询当前数据表叠加的管控数据swid集合
+            List<String> gkdataswids = new ArrayList<>();
+            List<GeometryParams> geometrys = new ArrayList<>();
+            resultSet = statement.executeQuery("select 编号集合 as swids, swid ,b.xmin, b.xmax, b.ymin, b.ymax, (select servicename from t_analyse_vector where tablename = '" + tablename + "') as servicename  from " + tablename + " a " +
+                    "left join idx_" + tablename + "_geom b  on b.rowid = a.rowid " +
+                    " where a.合法性判断 = '疑似违法'");
+            while (resultSet.next()) {
+                gkdataswids.add(resultSet.getString("swids"));
+                GeometryParams geometry = new GeometryParams();
+                geometry.setSwid(resultSet.getString("swid"));
+                geometry.setXmin(resultSet.getString("xmin"));
+                geometry.setXmax(resultSet.getString("xmax"));
+                geometry.setYmin(resultSet.getString("ymin"));
+                geometry.setYmax(resultSet.getString("ymax"));
+                geometry.setLayername(resultSet.getString("servicename"));
+                geometrys.add(geometry);
+            }
+            //TODO 创建Excel工作簿和工作表
+            Workbook workbook = new XSSFWorkbook();
+
+            //TODO 遍历管控数据,根据重叠的swid集合查询属性表并保存到excel的sheet
+            for (int i = 0; i < tables.size(); i++) {
+                String curtablename = (String) tables.get(i).get("tablename");
+                String curlayername = (String) tables.get(i).get("layername");
+                String curservicename = (String) tables.get(i).get("servicename");
+
+                //TODO 导入地图压覆图片 存储到本地指定位置
+                for (int m = 0; m < geometrys.size(); m++) {
+                    GeometryParams geometry = geometrys.get(m);
+                    Map<String, Object> params = new HashMap<>();
+                    Double xmin = Double.valueOf(geometry.getXmin());
+                    Double xmax = Double.valueOf(geometry.getXmax());
+                    Double ymin = Double.valueOf(geometry.getYmin());
+                    Double ymax = Double.valueOf(geometry.getYmax());
+                    params.put("SERVICE", "WMS");
+                    params.put("VERSION", "1.1.1");
+                    params.put("REQUEST", "GetMap");
+                    params.put("TRANSPARENT", true);
+                    params.put("FORMAT", "image/jpeg");
+                    params.put("EXCEPTIONS", "application/vnd.ogc.se_inimage");
+                    params.put("STYLES", "");
+                    params.put("LAYERS", encode(curservicename + "," + geometry.getLayername()));
+                    params.put("SRS", proj);
+                    //TODO 计算出图尺寸
+                    if ("width".equals(fixed)) {
+                        params.put("WIDTH", imageSize);
+                        params.put("HEIGHT", Integer.valueOf((int) ((ymax - ymin) / (xmax - xmin) * imageSize)));
+                    } else if ("height".equals(fixed)) {
+                        params.put("HEIGHT", imageSize);
+                        params.put("WIDTH", Integer.valueOf((int) ((xmax - xmin) / (ymax - ymin) * imageSize)));
+                    }
+                    params.put("BBOX", String.format("%s,%s,%s,%s", xmin, ymin, xmax, ymax));
+                    File f = new File(filepath);
+                    String parent = f.getParentFile().getAbsolutePath() + "/mapimages/";
+//                    String imageUrl = "http://localhost:28085/geoserver/spot/wms"; // 替换为实际的图片 URL
+                    String imageUrl = geoserverurl; // 替换为实际的图片 URL
+                    String outputFilePath = parent + "" + geometry.getSwid() + "_" + curlayername + ".png"; // 保存图片的文件路径
+                    try {
+                        File folder = new File(parent);
+                        if (!folder.exists()) {
+                            folder.mkdirs();
+                        }
+                        downloadImage(imageUrl, outputFilePath, params);
+                    } catch (IOException e) {
+                        e.printStackTrace();
+                    }
+                }
+
+                Sheet sheet = workbook.createSheet(curlayername);
+                List<String> gkdataswid = new ArrayList<>();
+                for (int u = 0; u < gkdataswids.size(); u++) {
+                    String[] swid = gkdataswids.get(u).split("(?<=;)(?=;)|;")[i].split(",");
+                    for (int p = 0; p < swid.length; p++) {
+                        if (StringUtils.isNotEmpty(swid[p])) {
+                            gkdataswid.add("'" + swid[p] + "'");
+                        }
+                    }
+                }
+                String swids = String.join(",", gkdataswid);
+                resultSet = statement.executeQuery("SELECT * from  " + curtablename + " where swid in (" + swids + ")");
+                // 写入标题行
+                Row header = sheet.createRow(0);
+                ResultSetMetaData metaData = resultSet.getMetaData();
+                int columnCount = metaData.getColumnCount();
+                for (int r = 0; r < columnCount; r++) {
+                    header.createCell(r).setCellValue(metaData.getColumnName(r + 1));
+                }
+                // 写入数据行
+                int rowCount = 1;
+                while (resultSet.next()) {
+                    Row row = sheet.createRow(rowCount++);
+                    for (int r = 0; r < columnCount; r++) {
+                        String field = metaData.getColumnName(r + 1);
+                        if (field.contains("shape") || field.contains("geom")) {
+                            row.createCell(r).setCellValue("");
+                        } else {
+                            row.createCell(r).setCellValue(resultSet.getString(field));
+                        }
+                    }
+                }
+            }
+            resultSet.close();
+            statement.close();
+            connection.close();
+            //TODO 写入Excel文件
+            FileOutputStream outputStream = new FileOutputStream(filepath);
+            workbook.write(outputStream);
+            outputStream.close();
+            System.out.println("Excel文件已导出");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return true;
+    }
+
+    /**
+     * 转换地址栏中的中文
+     *
+     * @param value
+     * @return
+     */
+    public static String encode(String value) {
+        try {
+            return URLEncoder.encode(value, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+        }
+        return value;
+    }
+
+
+    /**
+     * 根据http get地址请求图片 并保存到指定磁盘路径
+     *
+     * @param imageUrl
+     * @param outputFilePath
+     * @param params
+     * @throws IOException
+     */
+    public static void downloadImage(String imageUrl, String outputFilePath, Map<String, Object> params) throws IOException {
+        //封装参数
+        String requestUrl = imageUrl + "?";
+        for (String key : params.keySet()) {
+            Object value = params.get(key); // 使用 key 获取值
+            requestUrl += key + "=" + value + "&";
+        }
+        // 创建 URL 对象
+        URL url = new URL(requestUrl);
+        // 打开连接并设置请求方法
+        HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+        connection.setRequestMethod("GET");
+        connection.setConnectTimeout(5000);  // 设置连接超时
+        connection.setReadTimeout(5000);     // 设置读取超时
+        // 获取响应状态码
+        int statusCode = connection.getResponseCode();
+        if (statusCode != HttpURLConnection.HTTP_OK) {
+            throw new IOException("HTTP request failed with status code: " + statusCode);
+        }
+        // 获取输入流(图片数据)
+        try (InputStream inputStream = connection.getInputStream();
+             FileOutputStream outputStream = new FileOutputStream(outputFilePath)) {
+            // 缓冲区
+            byte[] buffer = new byte[4096];
+            int bytesRead;
+            // 读取输入流并写入文件
+            while ((bytesRead = inputStream.read(buffer)) != -1) {
+                outputStream.write(buffer, 0, bytesRead);
+            }
+//            System.out.println("Download complete!");
+        } finally {
+            connection.disconnect();  // 关闭连接
+        }
+    }
+}

+ 173 - 0
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/GeoServer.java

@@ -0,0 +1,173 @@
+package com.onemap.overlap.utils;
+
+import com.google.gson.Gson;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.util.EntityUtils;
+import org.geotools.data.FileDataStore;
+import org.geotools.data.shapefile.ShapefileDataStoreFactory;
+import org.geotools.referencing.CRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
+import java.util.Map;
+
+public class GeoServer {
+
+    public static void main(String[] args) {
+        try {
+            List<String> styles = getStyles("http://127.0.0.1:28085/geoserver", "admin", "geoserver", "spot");
+            System.out.println(styles);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取geoserver工作空间下的所有样式
+     *
+     * @param geoserverurl
+     * @param username
+     * @param password
+     * @param workspace
+     * @return
+     * @throws IOException
+     */
+    public static List<String> getStyles(String geoserverurl, String username, String password, String workspace) throws IOException {
+        CloseableHttpClient client = HttpClients.createDefault();
+        // TODO 设置 Basic Authentication 头
+        String auth = username + ":" + password;
+        String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
+
+        HttpGet getRequest = new HttpGet(geoserverurl + "/rest/workspaces/" + workspace + "/styles");
+        getRequest.setHeader("Authorization", "Basic " + encodedAuth);
+        List<String> style = new ArrayList<>();
+        try (CloseableHttpResponse response = client.execute(getRequest)) {
+            String responseEntity = EntityUtils.toString(response.getEntity());
+            System.out.println(responseEntity);
+            Gson gson = new Gson();
+            // 将 JSON 字符串转换为 Map
+            Map<String, Object> responseMap = gson.fromJson(responseEntity, Map.class);
+            Map<String, Object> styles = (Map<String, Object>) responseMap.get("styles");
+            List<Map> stylelist = (List<Map>) styles.get("style");
+            System.out.println(stylelist);
+            for (int i = 0; i < stylelist.size(); i++) {
+                Map<String, Object> cur = stylelist.get(i);
+                style.add(workspace + ":" + cur.get("name"));
+            }
+        }
+        return style;
+    }
+
+    /**
+     * 将本地shp文件发布到geoserver并配置相应样式
+     *
+     * @param geoserverurl
+     * @param username
+     * @param password
+     * @param workspace
+     * @param filepath
+     * @param stylename
+     * @throws IOException
+     */
+    public static void publishShp(String geoserverurl, String username, String password, String workspace, String filepath, String stylename, String datasource) throws IOException {
+//        File file = new File(filepath);
+//        String fileName = file.getName();
+//        int dotIndex = fileName.lastIndexOf('.');
+//        String datasource = dotIndex != -1 ? fileName.substring(0, dotIndex) : fileName;
+
+        CloseableHttpClient client = HttpClients.createDefault();
+        // TODO 设置 Basic Authentication 头
+        String auth = username + ":" + password;
+        String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
+
+        // TODO 创建数据存储时的XML请求体,指定文件路径
+        String xmlRequest = "<dataStore>" +
+                "<name>" + datasource + "</name>" +
+                "<connectionParameters>" +
+                "<entry key=\"url\">file:" + filepath + "</entry>" +
+                "<entry key=\"connector\">Shapefile</entry>" +
+                "<entry key=\"charset\">UTF-8</entry>" +
+                "</connectionParameters>" +
+                "</dataStore>";
+        HttpPost postRequest = new HttpPost(geoserverurl + "/rest/workspaces/" + workspace + "/datastores");
+        postRequest.setHeader("Authorization", "Basic " + encodedAuth);
+        postRequest.setEntity(new StringEntity(xmlRequest));
+        postRequest.setHeader("Content-Type", "application/xml");
+        try (CloseableHttpResponse response = client.execute(postRequest)) {
+            String responseEntity = EntityUtils.toString(response.getEntity());
+            System.out.println(responseEntity);
+        }
+
+        // TODO 创建发布图层的请求体
+        String publishRequest = "<featureType>" +
+                "<title>" + datasource + "</title>" +
+                "<name>" + datasource + "</name>" +
+                "</featureType>";
+        postRequest = new HttpPost(geoserverurl + "/rest/workspaces/" + workspace + "/datastores/" + datasource + "/featuretypes");
+        postRequest.setEntity(new StringEntity(publishRequest));
+        postRequest.setHeader("Authorization", "Basic " + encodedAuth);
+        postRequest.setHeader("Content-Type", "application/xml");
+        try (CloseableHttpResponse response = client.execute(postRequest)) {
+            String responseEntity = EntityUtils.toString(response.getEntity());
+            System.out.println(responseEntity);
+        }
+        updateStyle(stylename, geoserverurl, username, password, workspace + ":" + datasource);
+        client.close();
+    }
+
+    public static void updateStyle(String stylename, String geoserverurl, String username, String password, String datasource) {
+        try {
+            CloseableHttpClient client = HttpClients.createDefault();
+            // TODO 创建图层样式的请求体
+            String styleRequest = "<layer><defaultStyle>" +
+                    "<name>" + stylename + "</name>" +
+                    "</defaultStyle></layer>";
+            String auth = username + ":" + password;
+            String encodedAuth = Base64.getEncoder().encodeToString(auth.getBytes(StandardCharsets.UTF_8));
+            HttpPut putRequest = new HttpPut(geoserverurl + "/rest/layers/" + datasource);
+            putRequest.setEntity(new StringEntity(styleRequest));
+            putRequest.setHeader("Authorization", "Basic " + encodedAuth);
+            putRequest.setHeader("Content-Type", "application/xml");
+            try (CloseableHttpResponse response = client.execute(putRequest)) {
+                String responseEntity = EntityUtils.toString(response.getEntity());
+                System.out.println(responseEntity);
+            }
+            client.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 获取shp文件的epsg编码
+     *
+     * @param shpFilePath
+     * @return
+     */
+    public static String getShpEPSG(String shpFilePath) {
+        try {
+            File shpFile = new File(shpFilePath);
+            // 通过Shapefile加载数据
+            FileDataStore store = new ShapefileDataStoreFactory().createDataStore(shpFile.toURI().toURL());
+            // 获取CoordinateReferenceSystem
+            CoordinateReferenceSystem crs = store.getSchema().getCoordinateReferenceSystem();
+            // 获取SRID
+            Integer srid = CRS.lookupEpsgCode(crs, false);
+            return "EPSG:" + srid;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "EPSG:4326";
+    }
+}

+ 0 - 52
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/GeoServerSpatialiteJDBC.java

@@ -1,52 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import java.sql.Connection;
-//import java.sql.DriverManager;
-//import java.sql.ResultSet;
-//import java.sql.Statement;
-//import java.sql.SQLException;
-//
-//public class GeoServerSpatialiteJDBC {
-//    public static void main(String[] args) {
-//        // 设置数据库路径(.sqlite 或 .spatialite)
-//        String jdbcUrl = "jdbc:sqlite:D:\\temp\\mappatchcheck.sqlite"; // SQLite 数据库路径
-//        String spatialiteJdbcUrl = jdbcUrl + "?load_extension=true";  // 启用 SpatiaLite 扩展
-//
-//        try {
-//            // 注册 SQLite JDBC 驱动
-//            Class.forName("org.sqlite.JDBC");/**/
-//
-//            // 创建数据库连接(启用 SpatiaLite 扩展)
-//            Connection conn = DriverManager.getConnection(jdbcUrl);
-//
-//            // 通过 SQL 语句加载 SpatiaLite 扩展
-//            Statement stmt = conn.createStatement();
-////            stmt.execute("SELECT load_extension('mod_spatialite')");
-//
-//            // 执行空间查询
-//            // 假设表名为 'my_table',字段 'geom' 是空间数据列
-//            String query = "SELECT id, name, AsText(geom) FROM wuchuan4525 WHERE ST_Within(geom, ST_GeomFromText('POLYGON((...))', 4326))";
-//            ResultSet rs = stmt.executeQuery(query);
-//
-//            // 处理查询结果
-//            while (rs.next()) {
-//                int id = rs.getInt("id");
-//                String name = rs.getString("name");
-//                String geom = rs.getString("AsText(geom)");
-//                System.out.println("ID: " + id + ", Name: " + name + ", Geometry: " + geom);
-//            }
-//
-//            // 关闭连接
-//            rs.close();
-//            stmt.close();
-//            conn.close();
-//
-//        } catch (ClassNotFoundException e) {
-//            System.out.println("SQLite JDBC Driver not found!");
-//            e.printStackTrace();
-//        } catch (SQLException e) {
-//            System.out.println("Database connection error!");
-//            e.printStackTrace();
-//        }
-//    }
-//}

+ 0 - 121
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/GeoToolsSpatialOverlay.java

@@ -1,121 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import org.geotools.data.DataStore;
-//import org.geotools.data.DataStoreFinder;
-//import org.geotools.data.FeatureSource;
-//import org.geotools.data.Transaction;
-//import org.geotools.data.memory.MemoryDataStore;
-//import org.geotools.data.shapefile.ShapefileDataStore;
-//import org.geotools.data.shapefile.ShapefileDataStoreFactory;
-//import org.geotools.data.simple.SimpleFeatureCollection;
-//import org.geotools.data.simple.SimpleFeatureWriter;
-//import org.geotools.feature.FeatureCollection;
-//import org.geotools.feature.DefaultFeatureCollection;  // 引入 DefaultFeatureCollection
-//import org.geotools.feature.FeatureIterator;
-//import org.geotools.feature.simple.SimpleFeatureBuilder;
-//import org.geotools.feature.simple.SimpleFeatureTypeImpl;
-//import org.locationtech.jts.geom.Geometry;
-//import org.locationtech.jts.geom.GeometryFactory;
-//import org.opengis.feature.Feature;
-//import org.opengis.feature.simple.SimpleFeature;
-//import org.opengis.feature.simple.SimpleFeatureType;
-//
-//import java.io.File;
-//import java.util.HashMap;
-//import java.util.Iterator;
-//import java.util.Map;
-//
-//public class GeoToolsSpatialOverlay {
-//
-//    // 加载 Shapefile 文件并返回 FeatureCollection
-//    public static FeatureCollection loadShapefile(String shapefilePath) throws Exception {
-//        File file = new File(shapefilePath);
-//        ShapefileDataStore dataStore = new ShapefileDataStore(file.toURI().toURL());
-//        String typeName1 = dataStore.getTypeNames()[0];
-//        FeatureSource<SimpleFeatureType, SimpleFeature> featureSource1 = dataStore.getFeatureSource(typeName1);
-//        FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection = featureSource1.getFeatures();
-//
-//        // 将第一个 Shapefile 数据加载到内存
-//        MemoryDataStore memoryDataStore = new MemoryDataStore();
-//        memoryDataStore.addFeatures(featureCollection);
-////        memoryDataStore.setSpatialIndex(true);  // 启用空间索引(例如,R-tree)
-//
-//        return featureCollection;
-//    }
-//
-//    // 执行交集(Intersection)分析
-//    public static FeatureCollection performIntersection(FeatureCollection layer1, FeatureCollection layer2) throws Exception {
-//        // 使用 DefaultFeatureCollection 来存储交集结果
-//        FeatureCollection resultCollection = new DefaultFeatureCollection();
-//
-//        GeometryFactory geometryFactory = new GeometryFactory();
-//
-//        // 遍历第一个图层
-////        for (Feature feature : layer1) {
-////
-////        }
-//        FeatureIterator iterator1 = layer1.features();
-//        while (iterator1.hasNext()) {
-//            SimpleFeature feature1 = (SimpleFeature)iterator1.next();
-//            Geometry geom1 = (Geometry) feature1.getDefaultGeometry();
-//            // 遍历第二个图层
-//            FeatureIterator iterator2 = layer2.features();
-//            while (iterator2.hasNext()) {
-//                SimpleFeature simpleFeature2 = (SimpleFeature)iterator2.next();
-//                Geometry geom2 = (Geometry) simpleFeature2.getDefaultGeometry();
-//                // 如果两者有交集,计算交集
-//                if (geom1.intersects(geom2)) {
-//                    Geometry intersection = geom1.intersection(geom2);
-//                    // 将交集结果添加到新的 FeatureCollection
-//                    SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(feature1.getFeatureType());
-//                    SimpleFeature newFeature = featureBuilder.buildFeature(null);
-//                    newFeature.setAttribute("the_geom", intersection);
-//                    ((DefaultFeatureCollection) resultCollection).add(newFeature);
-//                }
-//            }
-//        }
-//
-//        return resultCollection;
-//    }
-//
-//    // 导出结果到新的 Shapefile 文件
-//    public static void exportToShapefile(FeatureCollection featureCollection, String outputShapefilePath) throws Exception {
-//        File outputFile = new File(outputShapefilePath);
-//        Map<String, Object> params = new HashMap<>();
-//        params.put(ShapefileDataStoreFactory.URLP.key, outputFile.toURI().toURL());
-//
-//        // 创建新的 Shapefile DataStore
-//        ShapefileDataStore dataStore = (ShapefileDataStore) DataStoreFinder.getDataStore(params);
-//
-//        // 获取 FeatureCollection 的 schema 并创建新的 Shapefile Schema
-//        SimpleFeatureTypeImpl featureType = (SimpleFeatureTypeImpl) featureCollection.getSchema();
-//        dataStore.createSchema(featureType);
-//
-//        // 写入新的 Shapefile
-//        try (SimpleFeatureWriter writer = (SimpleFeatureWriter) dataStore.getFeatureWriterAppend(dataStore.getTypeNames()[0], Transaction.AUTO_COMMIT)) {
-//            for (int u = 0; u < featureCollection.size(); u++) {
-//                Feature feature = featureCollection.features().next();
-//                SimpleFeature simpleFeature = (SimpleFeature) feature;
-//                //for (SimpleFeature feature : featureCollection) {
-//                SimpleFeature newFeature = writer.next();
-//                newFeature.setAttributes(simpleFeature.getAttributes());
-//                writer.write();
-//            }
-//        }
-//    }
-//
-//    public static void main(String[] args) {
-//        try {
-//            // 加载两个输入的 Shapefile 文件
-//            FeatureCollection layer1 = loadShapefile("E:\\projects\\监测图斑审查上传\\图斑套合\\管控数据\\基本农田.shp");
-//            FeatureCollection layer2 = loadShapefile("D:\\temp\\wuchuan.shp");
-//            // 执行空间叠加分析,获取交集部分
-//            FeatureCollection result = performIntersection(layer1, layer2);
-//            // 导出交集结果到新的 Shapefile
-//            exportToShapefile(result, "D:\\temp\\temp.shp");
-//            System.out.println("空间叠加分析完成,结果已导出到新的 Shapefile。");
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//        }
-//    }
-//}

+ 0 - 24
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/LoadShapefile.java

@@ -1,24 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import org.geotools.data.DataStore;
-//import org.geotools.data.DataStoreFinder;
-//import org.geotools.data.shapefile.ShapefileDataStoreFactory;
-//import org.geotools.feature.FeatureCollection;
-//
-//import java.io.File;
-//import java.net.URL;
-//import java.util.HashMap;
-//import java.util.Map;
-//
-//public class LoadShapefile {
-//    public static FeatureCollection loadShapefile(String shapefilePath) throws Exception {
-//        File file = new File(shapefilePath);
-//        Map<String, Object> params = new HashMap<>();
-//        params.put(ShapefileDataStoreFactory.URLP.key, file.toURI().toURL());
-//
-//        DataStore dataStore = DataStoreFinder.getDataStore(params);
-//        String typeName = dataStore.getTypeNames()[0];  // 获取第一个图层
-//        FeatureCollection featureCollection = dataStore.getFeatureSource(typeName).getFeatures();
-//        return featureCollection;
-//    }
-//}

+ 0 - 35
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/OverlayAnalysis.java

@@ -1,35 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import org.geotools.data.simple.SimpleFeatureCollection;
-//
-//import org.geotools.feature.FeatureCollection;
-//import org.locationtech.jts.geom.Geometry;
-//import org.opengis.feature.simple.SimpleFeature;
-//
-//public class OverlayAnalysis {
-//    public static FeatureCollection performIntersection(FeatureCollection layer1, FeatureCollection layer2) throws Exception {
-//        FeatureCollection resultCollection = new SimpleFeatureCollection(); // 用来存储结果的集合
-//
-//        // 遍历第一个图层中的每个要素
-//        for (SimpleFeature feature1 : (SimpleFeatureCollection) layer1) {
-//            Geometry geom1 = (Geometry) feature1.getDefaultGeometry();
-//
-//            // 遍历第二个图层中的每个要素
-//            for (SimpleFeature feature2 : (SimpleFeatureCollection) layer2) {
-//                Geometry geom2 = (Geometry) feature2.getDefaultGeometry();
-//
-//                // 求交集
-//                if (geom1.intersects(geom2)) {
-//                    Geometry intersection = geom1.intersection(geom2);
-//
-//                    // 创建新的要素并加入结果集合
-//                    SimpleFeature newFeature = feature1.clone();
-//                    newFeature.setAttribute("geometry", intersection);  // 设置新的几何属性
-//                    resultCollection.add(newFeature);
-//                }
-//            }
-//        }
-//
-//        return resultCollection;
-//    }
-//}

+ 0 - 150
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShapefileOverlayAnalysis.java

@@ -1,150 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import org.gdal.ogr.*;
-//import org.gdal.osr.SpatialReference;
-//import org.geotools.feature.FeatureCollection;
-//
-//import java.util.ArrayList;
-//import java.util.List;
-//
-//import static java.lang.Math.round;
-//
-//public class ShapefileOverlayAnalysis {
-//    public static void main(String[] args) {
-//        long startTime = System.currentTimeMillis();
-//        // 初始化 GDAL
-//        ogr.RegisterAll();
-//
-//        // 设置文件路径
-//        String shapefile1 = "D:\\temp\\wuchuan.shp";
-//        String shapefile2 = "E:\\projects\\监测图斑审查上传\\图斑套合\\管控数据\\基本农田.shp";
-//        String outputShapefile = "D:\\temp\\temp.shp";
-//
-//        // 读取 Shapefile 图层
-//        DataSource ds1 = ogr.Open(shapefile1);
-//        DataSource ds2 = ogr.Open(shapefile2);
-//
-//        if (ds1 == null || ds2 == null) {
-//            System.err.println("Failed to open one or both shapefiles.");
-//            return;
-//        }
-//
-//        // 获取第一个图层
-//        Layer layer1 = ds1.GetLayer(0);
-//        Layer layer2 = ds2.GetLayer(0);
-//
-//        Geometry mergedGeometry = null;
-//
-//        // 遍历输入图层中的所有要素,并合并它们的几何
-//        Feature inputFeature;
-//        layer1.ResetReading();
-//        while ((inputFeature = layer1.GetNextFeature()) != null) {
-//            Geometry featureGeometry = inputFeature.GetGeometryRef();
-//            if (mergedGeometry == null) {
-//                mergedGeometry = featureGeometry.Clone();  // 初始化合并几何
-//            } else {
-//                mergedGeometry = mergedGeometry.Union(featureGeometry);  // 合并几何
-//            }
-//        }
-//
-//
-//        layer2.SetSpatialFilter(mergedGeometry);  // 设置空间查询过滤条件
-//
-//        // 创建输出文件
-//        Driver driver = ogr.GetDriverByName("ESRI Shapefile");
-//        if (driver == null) {
-//            System.err.println("Shapefile driver not available.");
-//            return;
-//        }
-//
-//        // 创建输出图层
-//        DataSource outputDataSource = driver.CreateDataSource(outputShapefile, null);
-//        if (outputDataSource == null) {
-//            System.err.println("Failed to create output shapefile.");
-//            return;
-//        }
-//
-//        // 获取图层的空间参考
-//        SpatialReference spatialReference = layer1.GetSpatialRef();
-//
-//        // 创建输出图层的字段结构
-//        Layer outputLayer = outputDataSource.CreateLayer("intersection", spatialReference, ogr.wkbPolygon, null);
-//        // 复制输入图层的字段定义到输出图层
-//        for (int i = 0; i < layer1.GetLayerDefn().GetFieldCount(); i++) {
-//            FieldDefn fieldDefn = layer1.GetLayerDefn().GetFieldDefn(i);
-//            outputLayer.CreateField(fieldDefn);
-//        }
-////        outputLayer.CreateField(new FieldDefn("ID", ogr.OFTInteger));
-//
-//        // 执行叠加分析(交集)
-//        Layer intersectionLayer = getIntersectionLayer(layer1, layer2);
-//
-//        // 将交集结果保存到输出文件
-//        Feature feature;
-//        while ((feature = intersectionLayer.GetNextFeature()) != null) {
-//            outputLayer.CreateFeature(feature);
-//        }
-//
-//        // 关闭数据源
-//        ds1.delete();
-//        ds2.delete();
-//        outputDataSource.delete();
-//
-//        // 获取程序结束时的时间
-//        long endTime = System.currentTimeMillis();
-//
-//        // 计算并输出程序运行时间
-//        long duration = endTime - startTime;
-//        System.out.println("程序运行时间: " + round(duration / 1000) + " 秒");
-//    }
-//
-//    /**
-//     * 获取两个图层的交集
-//     *
-//     * @param layer1 第一个图层
-//     * @param layer2 第二个图层
-//     * @return 交集图层
-//     */
-//    private static Layer getIntersectionLayer(Layer layer1, Layer layer2) {
-//        List<Feature> intersectedFeatures = new ArrayList<>();
-//
-//        // 遍历第一个图层
-//        Feature feature1;
-//        layer1.ResetReading();
-//        while ((feature1 = layer1.GetNextFeature()) != null) {
-//            Geometry geom1 = feature1.GetGeometryRef();
-//
-//            // 遍历第二个图层,检查交集
-//            Feature feature2;
-//            layer2.ResetReading();
-//            while ((feature2 = layer2.GetNextFeature()) != null) {
-//                Geometry geom2 = feature2.GetGeometryRef();
-//
-//                // 计算交集
-//                if (geom1.Intersects(geom2)) {
-//                    Geometry intersection = geom1.Intersection(geom2);
-//
-//                    // 如果交集非空,保存交集
-//                    if (!intersection.IsEmpty()) {
-//                        Feature intersectedFeature = feature1.Clone();
-//                        intersectedFeature.SetGeometry(intersection);
-//                        intersectedFeatures.add(intersectedFeature);
-//                    }
-//                }
-//            }
-//        }
-//
-//        // 创建新的图层来保存交集结果
-//        Driver driver = ogr.GetDriverByName("Memory");
-//        DataSource memoryDataSource = driver.CreateDataSource("memory", null);
-//        Layer resultLayer = memoryDataSource.CreateLayer("intersection", layer1.GetSpatialRef(), ogr.wkbPolygon, null);
-//        resultLayer.CreateField(new FieldDefn("ID", ogr.OFTInteger));
-//
-//        // 将交集要素写入内存图层
-//        for (Feature feature : intersectedFeatures) {
-//            resultLayer.CreateFeature(feature);
-//        }
-//
-//        return resultLayer;
-//    }
-//}

+ 0 - 63
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShapefileToGeoPackage.java

@@ -1,63 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import org.gdal.ogr.*;
-//import org.gdal.osr.SpatialReference;
-//
-//public class ShapefileToGeoPackage {
-//    public static void main(String[] args) {
-//        // 注册 OGR 驱动
-//        ogr.RegisterAll();
-//
-//        // 输入和输出文件路径
-//        String inputShapefile = "E:\\projects\\监测图斑审查上传\\图斑套合\\管控数据\\基本农田.shp";
-//        String outputGeoPackage = "D:\\temp\\test.gpkg";
-//
-//        // 打开输入 Shapefile 数据源
-//        DataSource inputDataSource = ogr.Open(inputShapefile);
-//        if (inputDataSource == null) {
-//            System.err.println("无法打开 Shapefile: " + inputShapefile);
-//            return;
-//        }
-//
-//        // 获取 Shapefile 图层
-//        Layer inputLayer = inputDataSource.GetLayer(0);
-//
-//        // 获取 GPKG 驱动
-//        Driver gpkgDriver = ogr.GetDriverByName("GPKG");
-//        if (gpkgDriver == null) {
-//            System.err.println("GeoPackage 驱动不可用");
-//            return;
-//        }
-//
-//        // 创建输出 GeoPackage 数据源
-//        DataSource outputDataSource = gpkgDriver.CreateDataSource(outputGeoPackage, null);
-//        if (outputDataSource == null) {
-//            System.err.println("无法创建 GeoPackage: " + outputGeoPackage);
-//            return;
-//        }
-//
-//        // 创建输出图层,使用输入图层的空间参考
-//        SpatialReference spatialRef = inputLayer.GetSpatialRef();
-//        Layer outputLayer = outputDataSource.CreateLayer(inputLayer.GetName(), spatialRef, inputLayer.GetGeomType(), null);
-//
-//        // 复制输入图层的字段到输出图层
-//        for (int i = 0; i < inputLayer.GetLayerDefn().GetFieldCount(); i++) {
-//            FieldDefn fieldDefn = inputLayer.GetLayerDefn().GetFieldDefn(i);
-//            outputLayer.CreateField(fieldDefn);
-//        }
-//
-//        // 将输入图层的要素复制到输出图层
-//        Feature inputFeature;
-//        inputLayer.ResetReading();
-//        while ((inputFeature = inputLayer.GetNextFeature()) != null) {
-//            Feature outputFeature = inputFeature.Clone();
-//            outputLayer.CreateFeature(outputFeature);
-//        }
-//
-//        // 关闭数据源
-//        inputDataSource.delete();
-//        outputDataSource.delete();
-//
-//        System.out.println("Shapefile 导入到 GeoPackage 完成!");
-//    }
-//}

+ 0 - 96
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShapefileToSpatiaLiteWithProjection.java

@@ -1,96 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import org.gdal.gdal.gdal;
-//import org.gdal.ogr.*;
-//import org.gdal.osr.*;
-//
-//public class ShapefileToSpatiaLiteWithProjection {
-//    public static void main(String[] args) {
-//        // 注册所有驱动
-//        ogr.RegisterAll();
-//        // 注册SpatiaLite驱动
-//        gdal.SetConfigOption("OGR_ENABLE_Spatialite", "ON");
-//        // 读取 Shapefile 文件
-//        String shapefilePath = "D:\\gisdata\\HaiNanXZQ\\XZQH3857.shp";
-//        String spatialiteDbPath = "D:\\temp\\mappatchcheck.sqlite";
-//        int srid = 4326;
-//
-//        // 创建 SpatiaLite 数据源(使用 SPATIALITE=YES 选项)
-//        Driver sqliteDriver = ogr.GetDriverByName("SQLite");
-//        if (sqliteDriver == null) {
-//            System.out.println("SQLite driver not available!");
-//            return;
-//        }
-//
-//        // 打开 Shapefile 数据源
-//        DataSource shapefile = ogr.Open(shapefilePath, 1); // 0 表示只读模式
-//        if (shapefile == null) {
-//            System.out.println("Failed to load Shapefile!");
-//            return;
-//        }
-//
-//        // 获取 Shapefile 图层
-//        Layer shapefileLayer = shapefile.GetLayer(0); // 假设我们只处理第一个图层
-//
-//        // 创建目标空间投影坐标系(例如:WGS 84,EPSG:4326)
-//        SpatialReference targetSpatialRef = new SpatialReference();
-//        targetSpatialRef.ImportFromEPSG(srid); // 设置为 EPSG:4326 坐标系(WGS84)
-//
-//        // 获取当前 Shapefile 图层的空间参考
-//        SpatialReference sourceSpatialRef = shapefileLayer.GetSpatialRef();
-//        if (sourceSpatialRef == null) {
-//            System.out.println("Shapefile does not have a defined coordinate system.");
-//            return;
-//        }
-//
-//        // 如果源空间参考与目标不同,则进行坐标转换
-//        if (sourceSpatialRef != null && sourceSpatialRef != targetSpatialRef) {
-//            // 创建坐标转换
-//            CoordinateTransformation transform = CoordinateTransformation.CreateCoordinateTransformation(sourceSpatialRef, targetSpatialRef);
-//
-//            // 遍历 Shapefile 中的每个要素并转换其坐标
-//            for (int i = 0; i < shapefileLayer.GetFeatureCount(); i++) {
-//                Feature feature = shapefileLayer.GetFeature(i);
-//                Geometry geometry = feature.GetGeometryRef();
-//
-//                // 将几何坐标从源坐标系转换到目标坐标系
-//                geometry.Transform(transform);
-//
-//                // 更新要素的几何数据
-//                feature.SetGeometry(geometry);
-//                shapefileLayer.SetFeature(feature);
-//            }
-//            System.out.println("Coordinate transformation applied.");
-//        }
-//
-//
-//
-//        String[] options = {"SPATIALITE=YES"};
-//        DataSource spatialiteDb = sqliteDriver.CreateDataSource(spatialiteDbPath, null);
-//        if (spatialiteDb == null) {
-//            System.out.println("Failed to create SpatiaLite database!");
-//            return;
-//        }
-//
-//        // 创建 SpatiaLite 图层(使用目标坐标系)
-//        String layerName = shapefileLayer.GetName();
-//        Layer spatialiteLayer = spatialiteDb.CreateLayer(layerName, targetSpatialRef, shapefileLayer.GetGeomType(), null);
-//        if (spatialiteLayer == null) {
-//            System.out.println("Failed to create layer in SpatiaLite.");
-//            return;
-//        }
-//
-//        // 将 Shapefile 图层复制到 SpatiaLite 图层
-//        spatialiteDb.CopyLayer(shapefileLayer, layerName, null);
-//
-//        // 创建空间索引
-//        String sql = "SELECT CreateSpatialIndex('" + layerName + "', 'geometry');";
-//        spatialiteDb.ExecuteSQL(sql);
-//
-//        // 关闭数据源
-//        shapefile.delete();
-//        spatialiteDb.delete();
-//
-//        System.out.println("Shapefile successfully imported to SpatiaLite with target projection.");
-//    }
-//}

+ 31 - 0
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/ShpSridRetriever.java

@@ -0,0 +1,31 @@
+package com.onemap.overlap.utils;
+
+import org.geotools.data.FileDataStore;
+import org.geotools.data.shapefile.ShapefileDataStore;
+import org.geotools.data.shapefile.ShapefileDataStoreFactory;
+import org.geotools.referencing.CRS;
+import org.geotools.referencing.crs.DefaultGeographicCRS;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+import java.io.File;
+import java.io.IOException;
+
+public class ShpSridRetriever {
+
+    public static String main(String[] args) {
+        String shpFilePath = "D:\\temp\\wuchuan0705.shp";
+        try {
+            File shpFile = new File(shpFilePath);
+            // 通过Shapefile加载数据
+            FileDataStore store = new ShapefileDataStoreFactory().createDataStore(shpFile.toURI().toURL());
+            // 获取CoordinateReferenceSystem
+            CoordinateReferenceSystem crs = store.getSchema().getCoordinateReferenceSystem();
+            // 获取SRID
+            Integer srid = CRS.lookupEpsgCode(crs, false);
+            return "EPSG:" + srid;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "EPSG:4326";
+    }
+}

+ 100 - 0
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/SpatiaLiteToShapefile.java

@@ -0,0 +1,100 @@
+package com.onemap.overlap.utils;
+
+import org.geotools.data.FeatureWriter;
+import org.geotools.data.shapefile.ShapefileDataStore;
+
+import org.geotools.data.simple.SimpleFeatureCollection;
+import org.geotools.factory.CommonFactoryFinder;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
+import org.geotools.geometry.jts.JTSFactoryFinder;
+import org.geotools.feature.DefaultFeatureCollection;
+import org.geotools.referencing.CRS;
+import org.locationtech.jts.io.WKTReader;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+
+import org.locationtech.jts.geom.*;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
+
+import java.io.File;
+import java.net.URI;
+import java.nio.charset.StandardCharsets;
+import java.sql.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+
+public class SpatiaLiteToShapefile {
+    public static void execute(String dbpath, String shppath, Integer epsg, String tablename) throws Exception {
+        // 创建 Shapefile 文件
+        File file = new File(shppath);
+        String srid = "EPSG:" + epsg;
+//        File file = new File("D:\\temp\\wuchuan0705\\package\\output.shp");
+//        String dbpath = "D:\\temp\\mappatchcheck.sqlite";
+//        String tablename = "sw_wuchuan0705_20241226145657";
+//        String srid = "EPSG:" + 4525;
+
+        Connection connection = SpatialiteUtils.getSpatialiteConnection(dbpath);
+        Statement statement = connection.createStatement();
+        ResultSet resultSet = statement.executeQuery("select *, astext(geom) as geomstr from " + tablename + " t order by 合法性判断 desc");
+        ResultSetMetaData metaData = resultSet.getMetaData();
+        int columnCount = metaData.getColumnCount();
+        List<String> fields = new ArrayList<>();
+        for (int i = 1; i <= columnCount; i++) {
+            if (!metaData.getColumnName(i).contains("geom")) {
+                fields.add(metaData.getColumnName(i));
+            }
+        }
+        SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
+        builder.setName("");
+        CoordinateReferenceSystem crs = CRS.decode(srid);
+        builder.setCRS(crs);
+        builder.add("geometry", MultiPolygon.class);
+        for (int i = 0; i < fields.size(); i++) {
+            builder.add(fields.get(i), String.class);
+        }
+        SimpleFeatureType featureType = builder.buildFeatureType();
+
+        // 创建数据存储对象
+        URI uri = file.toURI();
+        ShapefileDataStore dataStore = new ShapefileDataStore(uri.toURL());
+        // 设置字符编码为 UTF-8,避免中文乱码
+        dataStore.setCharset(StandardCharsets.UTF_8);
+        // 设置数据存储的特征类型
+        dataStore.createSchema(featureType);
+
+        // 创建特征集合
+        SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
+        DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
+
+        // 创建几个简单的点特征
+        List<SimpleFeature> features = new ArrayList<>();
+        while (resultSet.next()) {
+            //读取转换WKT
+            WKTReader wktReader = new WKTReader();
+            String wkt = resultSet.getString("geomstr");
+            // 使用 WKTReader 将 WKT 字符串解析为 Geometry 对象
+            Geometry geometry = wktReader.read(wkt);
+            featureBuilder.add(geometry);
+            SimpleFeature feature = featureBuilder.buildFeature(null);
+            for (int i = 0; i < fields.size(); i++) {
+                feature.setAttribute(fields.get(i), resultSet.getString(fields.get(i)));
+            }
+            features.add(feature);
+            featureCollection.add(feature);
+        }
+        String typename = dataStore.getTypeNames()[0];
+        try (FeatureWriter<SimpleFeatureType, SimpleFeature> writer = dataStore.getFeatureWriter(typename, null)) {
+            for (SimpleFeature feature : features) {
+                SimpleFeature nextFeature = writer.next();
+                nextFeature.setAttributes(feature.getAttributes());
+                writer.write();
+            }
+        }
+        statement.close();
+        connection.close();
+        System.out.println("Shapefile created at: " + file.getAbsolutePath());
+    }
+}

+ 0 - 56
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/SpatialiteSample.java

@@ -1,56 +0,0 @@
-//package com.onemap.overlap.utils;
-//
-//import java.sql.Connection;
-//import java.sql.ResultSet;
-//import java.sql.SQLException;
-//import java.sql.Statement;
-//
-//import org.sqlite.SQLiteConfig;
-//
-//public class SpatialiteSample {
-//
-//
-//    public static void main(String[] args) throws ClassNotFoundException, SQLException {
-//        // load the sqlite-JDBC driver using the current class loader
-//        Class.forName("org.sqlite.JDBC");
-//
-//        Connection conn = null;
-//        try {
-//            // enabling dynamic extension loading
-//            // absolutely required by SpatiaLite
-//            System.out.println(org.sqlite.SQLiteJDBCLoader.getVersion());
-////            System.setProperty("java.library.path", "E:\\google-download\\mod_spatialite-5.0.1-win-amd64\\mod_spatialite-5.0.1-win-amd64");
-//            SQLiteConfig config = new SQLiteConfig();
-//            config.enableLoadExtension(true);
-//            conn = config.createConnection("jdbc:sqlite:D:\\temp\\mappatchcheck.sqlite");
-//            // create a database connection
-////            conn = DriverManager.getConnection("jdbc:sqlite:spatialite-test.sqlite?enable_load_extension=1"
-////                    );
-////            conn.enableLoadExtension(true);
-//            Statement stmt = conn.createStatement();
-//            stmt.setQueryTimeout(30); // set timeout to 30 sec.
-//
-//            // loading SpatiaLite
-//            stmt.execute("SELECT load_extension('mod_spatialite')");
-//
-//            // checking SQLite and SpatiaLite version + target CPU
-//            String sql = "SELECT spatialite_version(), spatialite_target_cpu()";
-//            ResultSet rs = stmt.executeQuery(sql);
-//            while (rs.next()) {
-//                // read the result set
-//                String msg = "SQLite version: ";
-//                msg += rs.getString(1);
-//                System.out.println(msg);
-//                msg = "SpatiaLite version: ";
-//                msg += rs.getString(2);
-//                System.out.println(msg);
-//            }
-//            // enabling Spatial Metadata
-//            // this automatically initializes SPATIAL_REF_SYS and GEOMETRY_COLUMNS
-////            sql = "SELECT InitSpatialMetadata(1)";
-////            stmt.execute(sql);
-//        } catch (SQLException e) {
-//            throw new RuntimeException(e);
-//        }
-//    }
-//}

+ 1 - 1
onemap-modules/onemap-overlap/src/main/java/com/onemap/overlap/utils/WebViewExample.java

@@ -14,7 +14,7 @@ public class WebViewExample extends Application {
         // 创建 WebView
         WebView webView = new WebView();
         // 加载 Web 页面
-        webView.getEngine().load("http://127.0.0.1:9206");
+        webView.getEngine().load("http://192.168.60.52:9206");
 
         // 布局
         StackPane root = new StackPane();

+ 10 - 1
onemap-modules/onemap-overlap/src/main/resources/application.yml

@@ -37,5 +37,14 @@ image:
   hsx: DDOM
 # 入库到SpatiaLite数据库中的唯一属性字段
 swid: swid
+# 入库到SpatiaLite数据库中的面积字段
+swarea: swarea
 qgis: D:\Program Files\QGIS 3.34.9\bin\
-exportFields: 编号,后类型,合法性判断,合法性说明,面积
+exportFields: 编号,后类型,合法性判断,合法性说明,面积
+# 地图导出的配置  固定项是高度还是宽度  再根据比例计算尺寸
+mapExport:
+  fixed: width
+  size: 600
+# 套合分析完成后更新geoserver的符号样式配置
+checkedstyle: spot:spotcheck
+spotstyle: spot:spot