管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2023-02-19 84580a66aa12a0d7832eec116dbbb8bfd1e2364e
1
已添加1个文件
已修改4个文件
267 ■■■■■ 文件已修改
src/main/java/com/lf/server/config/PropertiesConfig.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/lf/server/controller/data/WmtsController.java 50 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/wmts/web.xml 186 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/wmts/说明.txt 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }
}
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);
        }
    }
}
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
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>北京市海淀区奥北科技园领智中心B座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>数字正射影像图(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>数字正射影像图注记(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>数字正射影像图混合图层(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>
src/main/resources/wmts/˵Ã÷.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