From 84580a66aa12a0d7832eec116dbbb8bfd1e2364e Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期日, 19 二月 2023 10:59:59 +0800
Subject: [PATCH] 1

---
 src/main/resources/wmts/web.xml                                 |  186 ++++---------------------------------
 src/main/resources/wmts/说明.txt                                  |   14 ++
 src/main/java/com/lf/server/config/PropertiesConfig.java        |    7 +
 src/main/resources/application.yml                              |   10 +
 src/main/java/com/lf/server/controller/data/WmtsController.java |   50 +++++++---
 5 files changed, 83 insertions(+), 184 deletions(-)

diff --git a/src/main/java/com/lf/server/config/PropertiesConfig.java b/src/main/java/com/lf/server/config/PropertiesConfig.java
index 8c59e4a..b2a51a9 100644
--- a/src/main/java/com/lf/server/config/PropertiesConfig.java
+++ b/src/main/java/com/lf/server/config/PropertiesConfig.java
@@ -34,6 +34,9 @@
     @Value("${sys.path.publish3dml}")
     private String publish3dmlPath;
 
+    @Value("{sys.tile_path}")
+    private String tilePath;
+
     public String getDownloadPath() {
         return downloadPath;
     }
@@ -65,4 +68,8 @@
     public String getPublish3dmlPath() {
         return publish3dmlPath;
     }
+
+    public String getTilePath() {
+        return tilePath;
+    }
 }
diff --git a/src/main/java/com/lf/server/controller/data/WmtsController.java b/src/main/java/com/lf/server/controller/data/WmtsController.java
index 5a82156..d72e3d4 100644
--- a/src/main/java/com/lf/server/controller/data/WmtsController.java
+++ b/src/main/java/com/lf/server/controller/data/WmtsController.java
@@ -1,20 +1,16 @@
 package com.lf.server.controller.data;
 
 import com.lf.server.annotation.SysLog;
-import com.lf.server.entity.all.StaticData;
-import com.lf.server.helper.GdalHelper;
-import com.lf.server.helper.StringHelper;
+import com.lf.server.config.PropertiesConfig;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.io.ClassPathResource;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
@@ -30,19 +26,19 @@
 @RestController
 @RequestMapping("/wmts")
 public class WmtsController {
+    @Autowired
+    PropertiesConfig config;
+
     private final static Log log = LogFactory.getLog(WmtsController.class);
 
     @SysLog()
-    @ApiOperation(value = "鏌ヨWMTS鍏冩暟鎹�")
+    @ApiOperation(value = "鑾峰彇WMTS鍏冩暟鎹�")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "token", value = "浠ょ墝", dataType = "String", required = true, defaultValue = "token", paramType = "path")})
-    @GetMapping("select/metas/{token}")
-    public void selectMetas(String service, String version, String request, @PathVariable(name = "token") String token, HttpServletRequest req, HttpServletResponse res) {
+            @ApiImplicitParam(name = "token", value = "浠ょ墝", required = true, dataType = "String", defaultValue = "token", paramType = "path")
+    })
+    @GetMapping("select/{token}/WMTSCapabilities.xml")
+    public void selectWmtsCapabilities(@PathVariable(name = "token") String token, HttpServletRequest req, HttpServletResponse res) {
         try {
-            if (!StaticData.WMTS.equals(service) || !StaticData.CAPABILITY.equals(request)) {
-                return;
-            }
-
             ClassPathResource resource = new ClassPathResource("wmts/web.xml");
             if (!resource.exists()) {
                 return;
@@ -53,7 +49,10 @@
             stream.read(data);
             stream.close();
 
+            String url = req.getRequestURL().toString().replace("WMTSCapabilities.xml", "tile");
+
             String result = new String(data, StandardCharsets.UTF_8);
+            result = result.replace("{url}", url);
             byte[] bytes = result.getBytes(StandardCharsets.UTF_8);
 
             res.setHeader("Content-Type", "application/xml;charset=UTF-8");
@@ -64,4 +63,25 @@
             log.error(ex.getMessage(), ex);
         }
     }
+
+    @ApiOperation(value = "鑾峰彇WMTS鐡︾墖")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "token", value = "浠ょ墝", required = true, dataType = "String", defaultValue = "token", paramType = "path"),
+            @ApiImplicitParam(name = "layer", value = "鍥惧眰绫诲瀷", required = true, dataType = "String", defaultValue = "TDTIMG"),
+            @ApiImplicitParam(name = "tilematrix", value = "灞傜骇", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "tilerow", value = "琛屽彿", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "tilecol", value = "鍒楀彿", required = true, dataType = "Integer")
+    })
+    @GetMapping("select/{token}/tile")
+    public void selectWmtsTile(@RequestParam("layer") String layer, @RequestParam("tilematrix") Integer l, @RequestParam("tilerow") Integer r,
+                               @RequestParam("tilecol") Integer c, @RequestParam("format") String format, @PathVariable(name = "token") String token,
+                               HttpServletRequest req, HttpServletResponse res) {
+        try {
+            // ServletServerHttpRequest ssRequest = new ServletServerHttpRequest(request)
+            String base = config.getTilePath();
+
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+        }
+    }
 }
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 51fde2d..0eab7a9 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -41,11 +41,11 @@
   datasource:
     name: prod
     # JDBC 鍩烘湰閰嶇疆 &currentSchema=public
-    url: jdbc:postgresql://192.168.20.205:5433/langfang?useAffectedRows=true
-    #url: jdbc:postgresql://127.0.0.1:5433/langfang?useAffectedRows=true
+    #url: jdbc:postgresql://192.168.20.205:5433/langfang?useAffectedRows=true
+    url: jdbc:postgresql://127.0.0.1:5433/langfang?useAffectedRows=true
     username : postgres
-    password: Postgres!_14_Lf
-    #password: postgres
+    #password: Postgres!_14_Lf
+    password: postgres
     driver-class-name: org.postgresql.Driver
     paltform: POSTGRESQL
     type: com.alibaba.druid.pool.DruidDataSource
@@ -149,6 +149,8 @@
   exportServer: http://192.168.20.205/ExportMap
   # Gdal椹卞姩鐩綍
   gdal_path: E:\terrait\TianJin\Zip\release-1928-x64-dev\release-1928-x64\bin
+  # 鐡︾墖鍦板潃
+  tile_path: E:\data\99.public\soft\LFData\2d\tiles
   path:
     # 涓嬭浇鐩綍锛堜笅杞芥枃浠讹級
     download: D:\LF\download
diff --git a/src/main/resources/wmts/web.xml b/src/main/resources/wmts/web.xml
index 3e24633..e4d84bc 100644
--- a/src/main/resources/wmts/web.xml
+++ b/src/main/resources/wmts/web.xml
@@ -6,8 +6,8 @@
     xmlns:gml="http://www.opengis.net/gml"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
   <ows:ServiceIdentification>
-    <ows:Title>Online Map  Service</ows:Title>
-    <ows:Abstract>Base on OGC 1.0.0</ows:Abstract>
+    <ows:Title>搴曞浘鏈嶅姟</ows:Title>
+    <ows:Abstract>鍩轰簬OGC 1.0.0</ows:Abstract>
     <ows:Keywords>
       <ows:Keyword>OGC</ows:Keyword>
     </ows:Keywords>
@@ -17,25 +17,25 @@
     <ows:AccessConstraints>none</ows:AccessConstraints>
   </ows:ServiceIdentification>
   <ows:ServiceProvider>
-    <ows:ProviderName>A4@PetroChina</ows:ProviderName>
-    <ows:ProviderSite>http://a4.petrochina</ows:ProviderSite>
+    <ows:ProviderName>娉扮憺鏁板垱绉戞妧(鍖椾含)鑲′唤鏈夐檺鍏徃</ows:ProviderName>
+    <ows:ProviderSite>https://www.smartearth.cn</ows:ProviderSite>
     <ows:ServiceContact>
-      <ows:IndividualName>Mr SHU</ows:IndividualName>
-      <ows:PositionName>Software Engineer</ows:PositionName>
+      <ows:IndividualName>WuWW</ows:IndividualName>
+      <ows:PositionName>鍖椾含宸ョ▼涓績</ows:PositionName>
       <ows:ContactInfo>
         <ows:Phone>
-          <ows:Voice>010-63881107</ows:Voice>
-          <ows:Facsimile>010-63881107</ows:Facsimile>
+          <ows:Voice>010-64845922</ows:Voice>
+          <ows:Facsimile>010-64845922</ows:Facsimile>
         </ows:Phone>
         <ows:Address>
-          <ows:DeliveryPoint>BEIJING DONG SI SHI TIAO Nan Xin Chang Shang Wu Da Sha</ows:DeliveryPoint>
-          <ows:City>BEIJING</ows:City>
-          <ows:AdministrativeArea>BEIJING</ows:AdministrativeArea>
-          <ows:Country>CHINA</ows:Country>
-          <ows:PostalCode>100830</ows:PostalCode>
-          <ows:ElectronicMailAddress>a4@petrochina.com.cn</ows:ElectronicMailAddress>
+          <ows:DeliveryPoint>鍖椾含甯傛捣娣�鍖哄ゥ鍖楃鎶�鍥鏅轰腑蹇傿搴�5灞�</ows:DeliveryPoint>
+          <ows:City>鍖椾含</ows:City>
+          <ows:AdministrativeArea>鍖椾含</ows:AdministrativeArea>
+          <ows:Country>涓浗</ows:Country>
+          <ows:PostalCode>100192</ows:PostalCode>
+          <ows:ElectronicMailAddress>info@terra-it.cn</ows:ElectronicMailAddress>
         </ows:Address>
-        <ows:OnlineResource xlink:type="simple" xlink:href="http://a4.petrochina"/>
+        <ows:OnlineResource xlink:type="simple" xlink:href="https://www.smartearth.cn"/>
       </ows:ContactInfo>
     </ows:ServiceContact>
   </ows:ServiceProvider>
@@ -43,7 +43,7 @@
     <ows:Operation name="GetCapabilities">
       <ows:DCP>
         <ows:HTTP>
-          <ows:Get xlink:href="<a4url>">
+          <ows:Get xlink:href="{url}">
             <ows:Constraint name="GetEncoding">
               <ows:AllowedValues>
                 <ows:Value>KVP</ows:Value>
@@ -56,7 +56,7 @@
     <ows:Operation name="GetTile">
       <ows:DCP>
         <ows:HTTP>
-          <ows:Get xlink:href="<a4url>">
+          <ows:Get xlink:href="{url}">
             <ows:Constraint name="GetEncoding">
               <ows:AllowedValues>
                 <ows:Value>KVP</ows:Value>
@@ -70,40 +70,8 @@
   <Contents>
     <Layer>
       <ows:Title>鏁板瓧绾垮垝鍥�(DLG)</ows:Title>
-      <ows:Abstract>TDTVEC</ows:Abstract>
-      <ows:Identifier>TDTVEC</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧绾垮垝鍥炬敞璁�(DLG)</ows:Title>
-      <ows:Abstract>TDTCVA</ows:Abstract>
-      <ows:Identifier>TDTCVA</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧绾垮垝娣峰悎鍥惧眰(DLG)</ows:Title>
-      <ows:Abstract>VECMIX</ows:Abstract>
-      <ows:Identifier>VECMIX</ows:Identifier>
+      <ows:Abstract>vec</ows:Abstract>
+      <ows:Identifier>vec</ows:Identifier>
       <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
         <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
         <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
@@ -118,120 +86,8 @@
     </Layer>
     <Layer>
       <ows:Title>鏁板瓧姝e皠褰卞儚鍥�(DOM)</ows:Title>
-      <ows:Abstract>TDTIMG</ows:Abstract>
-      <ows:Identifier>TDTIMG</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/jpeg</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧姝e皠褰卞儚鍥炬敞璁�(DOM)</ows:Title>
-      <ows:Abstract>TDTCIA</ows:Abstract>
-      <ows:Identifier>TDTCIA</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧姝e皠褰卞儚鍥炬贩鍚堝浘灞�(DOM)</ows:Title>
-      <ows:Abstract>IMGMIX</ows:Abstract>
-      <ows:Identifier>IMGMIX</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧楂樼▼妯″瀷(DEM)</ows:Title>
-      <ows:Abstract>TDTTER</ows:Abstract>
-      <ows:Identifier>TDTTER</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/jpeg</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧楂樼▼妯″瀷娉ㄨ(DEM)</ows:Title>
-      <ows:Abstract>TDTCTA</ows:Abstract>
-      <ows:Identifier>TDTCTA</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧楂樼▼妯″瀷娣峰悎鍥惧眰(DEM)</ows:Title>
-      <ows:Abstract>TERMIX</ows:Abstract>
-      <ows:Identifier>TERMIX</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>鏁板瓧娴峰浘(VCA)</ows:Title>
-      <ows:Abstract>TDTVCA</ows:Abstract>
-      <ows:Identifier>TDTVCA</ows:Identifier>
-      <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
-        <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
-        <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
-      </ows:WGS84BoundingBox>
-      <Style>
-        <ows:Identifier>default</ows:Identifier>
-      </Style>
-      <Format>image/png</Format>
-      <TileMatrixSetLink>
-        <TileMatrixSet>w</TileMatrixSet>
-      </TileMatrixSetLink>
-    </Layer>
-    <Layer>
-      <ows:Title>涓氬姟褰卞儚鍥�(DOM)</ows:Title>
-      <ows:Abstract>YWIMG</ows:Abstract>
-      <ows:Identifier>YWIMG</ows:Identifier>
+      <ows:Abstract>img</ows:Abstract>
+      <ows:Identifier>img</ows:Identifier>
       <ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
         <ows:LowerCorner>-180.0 -85.0</ows:LowerCorner>
         <ows:UpperCorner>180.0 85.0</ows:UpperCorner>
diff --git "a/src/main/resources/wmts/\350\257\264\346\230\216.txt" "b/src/main/resources/wmts/\350\257\264\346\230\216.txt"
new file mode 100644
index 0000000..a3a3b19
--- /dev/null
+++ "b/src/main/resources/wmts/\350\257\264\346\230\216.txt"
@@ -0,0 +1,14 @@
+娴嬭瘯鍦板潃锛�
+http://127.0.0.1:12316/server/wmts/select/token/WMTSCapabilities.xml
+
+http://127.0.0.1:12316/server/wmts/select/metas/token?service=WMTS&version=1.0.0&request=GetCapabilities
+
+
+
+QGIS锛氬畨瑁� HCMGIS 鎻掍欢銆�
+-----------------------------------------------------------------------------------------------
+http://103.85.165.99:8050/LFData/2d/tiles/img/{z}/{x}/{y}.png
+
+http://192.168.20.205:8088/geoserver/gwc/service/wmts?service=WMTS&version=1.0.0&request=GetCapabilities
+
+http://localhost:8080/geoserver/gwc/service/wmts?layer=cite:beijing&style=&tilematrixset=EPSG:4326&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&TileMatrix=EPSG:4326:7&TileCol=207&TileRow=35

--
Gitblit v1.9.3