区块链技术博客
www.b2bchain.cn

解决leaflet加载基于超图平台发布的WMTS服务两个图层级别不一致问题求职学习资料

本文介绍了解决leaflet加载基于超图平台发布的WMTS服务两个图层级别不一致问题求职学习资料,有助于帮助完成毕业设计以及求职,是一篇很好的资料。

对技术面试,学习经验等有一些体会,在此分享。

场景描述

工作中遇到需要加载WMTS底图的工作,底图分为标注和电子地图俩个图层。但是这两个图层的比例尺差1个级别。元数据如下:

  • 标注图层
<?xml version="1.0" encoding="UTF-8"?> <Capabilities     xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0.0/wmtsGetCapabilities_response.xsd"     version="1.0.0" xmlns="http://www.opengis.net/wmts/1.0"![](https://images.xiaozhuanlan.com/photo/2020/96681c06f03f76159a61082c91ee39e9.png)     xmlns:ows="http://www.opengis.net/ows/1.1"     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>在线地图服务</ows:Title>         <ows:Abstract>基于OGC标准的地图服务</ows:Abstract>         <ows:Keywords>             <ows:Keyword>OGC</ows:Keyword>         </ows:Keywords>         <ows:ServiceType codeSpace="wmts"/>         <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>         <ows:Fees>none</ows:Fees>         <ows:AccessConstraints>none</ows:AccessConstraints>     </ows:ServiceIdentification>     <ows:ServiceProvider>         <ows:ProviderName>天地图有限公司</ows:ProviderName>         <ows:ProviderSite>http://www.tianditu.com</ows:ProviderSite>         <ows:ServiceContact>             <ows:IndividualName>Mr Liu</ows:IndividualName>             <ows:PositionName>Software Engineer</ows:PositionName>             <ows:ContactInfo>                 <ows:Phone>                     <ows:Voice>010-88187700</ows:Voice>                     <ows:Facsimile>010-88187700</ows:Facsimile>                 </ows:Phone>                 <ows:Address>                     <ows:DeliveryPoint>北京市顺义区国家地理信息科技产业园天地图大厦(机场东路与龙塘路交叉口)</ows:DeliveryPoint>                     <ows:City>北京市</ows:City>                     <ows:AdministrativeArea>北京市</ows:AdministrativeArea>                     <ows:Country>中国</ows:Country>                     <ows:PostalCode>101399</ows:PostalCode>                     <ows:ElectronicMailAddress>tianditu.com</ows:ElectronicMailAddress>                 </ows:Address>                 <ows:OnlineResource xlink:type="simple" xlink:href="http://www.tianditu.com"/>             </ows:ContactInfo>         </ows:ServiceContact>     </ows:ServiceProvider>     <ows:OperationsMetadata>         <ows:Operation name="GetCapabilities">             <ows:DCP>                 <ows:HTTP>                     <ows:Get xlink:href="http://10.1.7.160:81/sla_c/wmts?">                         <ows:Constraint name="GetEncoding">                             <ows:AllowedValues>                                 <ows:Value>KVP</ows:Value>                             </ows:AllowedValues>                         </ows:Constraint>                     </ows:Get>                 </ows:HTTP>             </ows:DCP>         </ows:Operation>         <ows:Operation name="GetTile">             <ows:DCP>                 <ows:HTTP>                     <ows:Get xlink:href="http://10.1.7.160:81/sla_c/wmts?">                         <ows:Constraint name="GetEncoding">                             <ows:AllowedValues>                                 <ows:Value>KVP</ows:Value>                             </ows:AllowedValues>                         </ows:Constraint>                     </ows:Get>                 </ows:HTTP>             </ows:DCP>         </ows:Operation>     </ows:OperationsMetadata>     <Contents>         <Layer>             <ows:Title>sla</ows:Title>             <ows:Abstract>sla</ows:Abstract>             <ows:Identifier>sla</ows:Identifier>             <ows:WGS84BoundingBox>                 <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>                 <ows:UpperCorner>180.0 90.0</ows:UpperCorner>             </ows:WGS84BoundingBox>             <ows:BoundingBox>                 <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>                 <ows:UpperCorner>180.0 90.0</ows:UpperCorner>             </ows:BoundingBox>             <Style>                 <ows:Identifier>default</ows:Identifier>             </Style>             <Format>tiles</Format>             <TileMatrixSetLink>                 <TileMatrixSet>c</TileMatrixSet>             </TileMatrixSetLink>         </Layer>         <TileMatrixSet>             <ows:Identifier>c</ows:Identifier>             <ows:SupportedCRS>urn:ogc:def:crs:EPSG::4490</ows:SupportedCRS>             <TileMatrix>                 <ows:Identifier>1</ows:Identifier>                 <ScaleDenominator>2.958293554545656E8</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>2</MatrixWidth>                 <MatrixHeight>1</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>2</ows:Identifier>                 <ScaleDenominator>1.479146777272828E8</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>4</MatrixWidth>                 <MatrixHeight>2</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>3</ows:Identifier>                 <ScaleDenominator>7.39573388636414E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>8</MatrixWidth>                 <MatrixHeight>4</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>4</ows:Identifier>                 <ScaleDenominator>3.69786694318207E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>16</MatrixWidth>                 <MatrixHeight>8</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>5</ows:Identifier>                 <ScaleDenominator>1.848933471591035E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>32</MatrixWidth>                 <MatrixHeight>16</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>6</ows:Identifier>                 <ScaleDenominator>9244667.357955175</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>64</MatrixWidth>                 <MatrixHeight>32</MatrixHeight>             </TileMatrix>                                 <TileMatrix>                 <ows:Identifier>7</ows:Identifier>                 <ScaleDenominator>4622333.678977588</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>128</MatrixWidth>                 <MatrixHeight>64</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>8</ows:Identifier>                 <ScaleDenominator>2311166.839488794</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>256</MatrixWidth>                 <MatrixHeight>128</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>9</ows:Identifier>                 <ScaleDenominator>1155583.419744397</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>512</MatrixWidth>                 <MatrixHeight>256</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>10</ows:Identifier>                 <ScaleDenominator>577791.7098721985</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>1024</MatrixWidth>                 <MatrixHeight>512</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>11</ows:Identifier>                 <ScaleDenominator>288895.85493609926</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>2048</MatrixWidth>                 <MatrixHeight>1024</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>12</ows:Identifier>                 <ScaleDenominator>144447.92746804963</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>4096</MatrixWidth>                 <MatrixHeight>2048</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>13</ows:Identifier>                 <ScaleDenominator>72223.96373402482</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>8192</MatrixWidth>                 <MatrixHeight>4096</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>14</ows:Identifier>                 <ScaleDenominator>36111.98186701241</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>16384</MatrixWidth>                 <MatrixHeight>8192</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>15</ows:Identifier>                 <ScaleDenominator>18055.990933506204</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>32768</MatrixWidth>                 <MatrixHeight>16384</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>16</ows:Identifier>                 <ScaleDenominator>9027.995466753102</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>65536</MatrixWidth>                 <MatrixHeight>32768</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>17</ows:Identifier>                 <ScaleDenominator>4513.997733376551</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>131072</MatrixWidth>                 <MatrixHeight>65536</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>18</ows:Identifier>                 <ScaleDenominator>2256.998866688275</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>262144</MatrixWidth>                 <MatrixHeight>131072</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>19</ows:Identifier>                 <ScaleDenominator>1128.4994333441375</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>524288</MatrixWidth>                 <MatrixHeight>262144</MatrixHeight>             </TileMatrix>         </TileMatrixSet>     </Contents> </Capabilities>
  • 电子地图
    “`xml
    http://www.opengis.net/wmts/1.0 http://10.1.3.199:8092/iserver/services/map-ugcv5-ditu/wmts100/wmts,1.0,wmtsGetCapabilities_response.xsd”>
    示例 WMTS 服务 SuperMap iServer 基于示范数据发布的 WMTS 服务 iServer Sample Data OGC WMTS 1.0.0 none none
    北京超图软件股份有限公司 联系人姓名 联系人职位 +86-10-59896655 +86-10-59896666 北京市朝阳区酒仙桥北路甲10号院电子城IT产业园107号楼6层北京超图软件股份有限公司 北京 北京 100015 中国 support@supermap.com

    RESTFUL KVP application/xml




场景描述

工作中遇到需要加载WMTS底图的工作,底图分为标注和电子地图俩个图层。但是这两个图层的比例尺差1个级别。元数据如下:

  • 标注图层
<?xml version="1.0" encoding="UTF-8"?> <Capabilities     xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0.0/wmtsGetCapabilities_response.xsd"     version="1.0.0" xmlns="http://www.opengis.net/wmts/1.0"![](https://images.xiaozhuanlan.com/photo/2020/96681c06f03f76159a61082c91ee39e9.png)     xmlns:ows="http://www.opengis.net/ows/1.1"     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>在线地图服务</ows:Title>         <ows:Abstract>基于OGC标准的地图服务</ows:Abstract>         <ows:Keywords>             <ows:Keyword>OGC</ows:Keyword>         </ows:Keywords>         <ows:ServiceType codeSpace="wmts"/>         <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>         <ows:Fees>none</ows:Fees>         <ows:AccessConstraints>none</ows:AccessConstraints>     </ows:ServiceIdentification>     <ows:ServiceProvider>         <ows:ProviderName>天地图有限公司</ows:ProviderName>         <ows:ProviderSite>http://www.tianditu.com</ows:ProviderSite>         <ows:ServiceContact>             <ows:IndividualName>Mr Liu</ows:IndividualName>             <ows:PositionName>Software Engineer</ows:PositionName>             <ows:ContactInfo>                 <ows:Phone>                     <ows:Voice>010-88187700</ows:Voice>                     <ows:Facsimile>010-88187700</ows:Facsimile>                 </ows:Phone>                 <ows:Address>                     <ows:DeliveryPoint>北京市顺义区国家地理信息科技产业园天地图大厦(机场东路与龙塘路交叉口)</ows:DeliveryPoint>                     <ows:City>北京市</ows:City>                     <ows:AdministrativeArea>北京市</ows:AdministrativeArea>                     <ows:Country>中国</ows:Country>                     <ows:PostalCode>101399</ows:PostalCode>                     <ows:ElectronicMailAddress>tianditu.com</ows:ElectronicMailAddress>                 </ows:Address>                 <ows:OnlineResource xlink:type="simple" xlink:href="http://www.tianditu.com"/>             </ows:ContactInfo>         </ows:ServiceContact>     </ows:ServiceProvider>     <ows:OperationsMetadata>         <ows:Operation name="GetCapabilities">             <ows:DCP>                 <ows:HTTP>                     <ows:Get xlink:href="http://10.1.7.160:81/sla_c/wmts?">                         <ows:Constraint name="GetEncoding">                             <ows:AllowedValues>                                 <ows:Value>KVP</ows:Value>                             </ows:AllowedValues>                         </ows:Constraint>                     </ows:Get>                 </ows:HTTP>             </ows:DCP>         </ows:Operation>         <ows:Operation name="GetTile">             <ows:DCP>                 <ows:HTTP>                     <ows:Get xlink:href="http://10.1.7.160:81/sla_c/wmts?">                         <ows:Constraint name="GetEncoding">                             <ows:AllowedValues>                                 <ows:Value>KVP</ows:Value>                             </ows:AllowedValues>                         </ows:Constraint>                     </ows:Get>                 </ows:HTTP>             </ows:DCP>         </ows:Operation>     </ows:OperationsMetadata>     <Contents>         <Layer>             <ows:Title>sla</ows:Title>             <ows:Abstract>sla</ows:Abstract>             <ows:Identifier>sla</ows:Identifier>             <ows:WGS84BoundingBox>                 <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>                 <ows:UpperCorner>180.0 90.0</ows:UpperCorner>             </ows:WGS84BoundingBox>             <ows:BoundingBox>                 <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>                 <ows:UpperCorner>180.0 90.0</ows:UpperCorner>             </ows:BoundingBox>             <Style>                 <ows:Identifier>default</ows:Identifier>             </Style>             <Format>tiles</Format>             <TileMatrixSetLink>                 <TileMatrixSet>c</TileMatrixSet>             </TileMatrixSetLink>         </Layer>         <TileMatrixSet>             <ows:Identifier>c</ows:Identifier>             <ows:SupportedCRS>urn:ogc:def:crs:EPSG::4490</ows:SupportedCRS>             <TileMatrix>                 <ows:Identifier>1</ows:Identifier>                 <ScaleDenominator>2.958293554545656E8</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>2</MatrixWidth>                 <MatrixHeight>1</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>2</ows:Identifier>                 <ScaleDenominator>1.479146777272828E8</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>4</MatrixWidth>                 <MatrixHeight>2</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>3</ows:Identifier>                 <ScaleDenominator>7.39573388636414E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>8</MatrixWidth>                 <MatrixHeight>4</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>4</ows:Identifier>                 <ScaleDenominator>3.69786694318207E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>16</MatrixWidth>                 <MatrixHeight>8</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>5</ows:Identifier>                 <ScaleDenominator>1.848933471591035E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>32</MatrixWidth>                 <MatrixHeight>16</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>6</ows:Identifier>                 <ScaleDenominator>9244667.357955175</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>64</MatrixWidth>                 <MatrixHeight>32</MatrixHeight>             </TileMatrix>                                 <TileMatrix>                 <ows:Identifier>7</ows:Identifier>                 <ScaleDenominator>4622333.678977588</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>128</MatrixWidth>                 <MatrixHeight>64</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>8</ows:Identifier>                 <ScaleDenominator>2311166.839488794</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>256</MatrixWidth>                 <MatrixHeight>128</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>9</ows:Identifier>                 <ScaleDenominator>1155583.419744397</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>512</MatrixWidth>                 <MatrixHeight>256</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>10</ows:Identifier>                 <ScaleDenominator>577791.7098721985</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>1024</MatrixWidth>                 <MatrixHeight>512</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>11</ows:Identifier>                 <ScaleDenominator>288895.85493609926</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>2048</MatrixWidth>                 <MatrixHeight>1024</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>12</ows:Identifier>                 <ScaleDenominator>144447.92746804963</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>4096</MatrixWidth>                 <MatrixHeight>2048</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>13</ows:Identifier>                 <ScaleDenominator>72223.96373402482</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>8192</MatrixWidth>                 <MatrixHeight>4096</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>14</ows:Identifier>                 <ScaleDenominator>36111.98186701241</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>16384</MatrixWidth>                 <MatrixHeight>8192</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>15</ows:Identifier>                 <ScaleDenominator>18055.990933506204</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>32768</MatrixWidth>                 <MatrixHeight>16384</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>16</ows:Identifier>                 <ScaleDenominator>9027.995466753102</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>65536</MatrixWidth>                 <MatrixHeight>32768</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>17</ows:Identifier>                 <ScaleDenominator>4513.997733376551</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>131072</MatrixWidth>                 <MatrixHeight>65536</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>18</ows:Identifier>                 <ScaleDenominator>2256.998866688275</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>262144</MatrixWidth>                 <MatrixHeight>131072</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>19</ows:Identifier>                 <ScaleDenominator>1128.4994333441375</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>524288</MatrixWidth>                 <MatrixHeight>262144</MatrixHeight>             </TileMatrix>         </TileMatrixSet>     </Contents> </Capabilities>
  • 电子地图
    “`xml
    http://www.opengis.net/wmts/1.0 http://10.1.3.199:8092/iserver/services/map-ugcv5-ditu/wmts100/wmts,1.0,wmtsGetCapabilities_response.xsd”>
    示例 WMTS 服务 SuperMap iServer 基于示范数据发布的 WMTS 服务 iServer Sample Data OGC WMTS 1.0.0 none none
    北京超图软件股份有限公司 联系人姓名 联系人职位 +86-10-59896655 +86-10-59896666 北京市朝阳区酒仙桥北路甲10号院电子城IT产业园107号楼6层北京超图软件股份有限公司 北京 北京 100015 中国 support@supermap.com

    RESTFUL KVP application/xml




场景描述

工作中遇到需要加载WMTS底图的工作,底图分为标注和电子地图俩个图层。但是这两个图层的比例尺差1个级别。元数据如下:

  • 标注图层
<?xml version="1.0" encoding="UTF-8"?> <Capabilities     xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0.0/wmtsGetCapabilities_response.xsd"     version="1.0.0" xmlns="http://www.opengis.net/wmts/1.0"![](https://images.xiaozhuanlan.com/photo/2020/96681c06f03f76159a61082c91ee39e9.png)     xmlns:ows="http://www.opengis.net/ows/1.1"     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>在线地图服务</ows:Title>         <ows:Abstract>基于OGC标准的地图服务</ows:Abstract>         <ows:Keywords>             <ows:Keyword>OGC</ows:Keyword>         </ows:Keywords>         <ows:ServiceType codeSpace="wmts"/>         <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>         <ows:Fees>none</ows:Fees>         <ows:AccessConstraints>none</ows:AccessConstraints>     </ows:ServiceIdentification>     <ows:ServiceProvider>         <ows:ProviderName>天地图有限公司</ows:ProviderName>         <ows:ProviderSite>http://www.tianditu.com</ows:ProviderSite>         <ows:ServiceContact>             <ows:IndividualName>Mr Liu</ows:IndividualName>             <ows:PositionName>Software Engineer</ows:PositionName>             <ows:ContactInfo>                 <ows:Phone>                     <ows:Voice>010-88187700</ows:Voice>                     <ows:Facsimile>010-88187700</ows:Facsimile>                 </ows:Phone>                 <ows:Address>                     <ows:DeliveryPoint>北京市顺义区国家地理信息科技产业园天地图大厦(机场东路与龙塘路交叉口)</ows:DeliveryPoint>                     <ows:City>北京市</ows:City>                     <ows:AdministrativeArea>北京市</ows:AdministrativeArea>                     <ows:Country>中国</ows:Country>                     <ows:PostalCode>101399</ows:PostalCode>                     <ows:ElectronicMailAddress>tianditu.com</ows:ElectronicMailAddress>                 </ows:Address>                 <ows:OnlineResource xlink:type="simple" xlink:href="http://www.tianditu.com"/>             </ows:ContactInfo>         </ows:ServiceContact>     </ows:ServiceProvider>     <ows:OperationsMetadata>         <ows:Operation name="GetCapabilities">             <ows:DCP>                 <ows:HTTP>                     <ows:Get xlink:href="http://10.1.7.160:81/sla_c/wmts?">                         <ows:Constraint name="GetEncoding">                             <ows:AllowedValues>                                 <ows:Value>KVP</ows:Value>                             </ows:AllowedValues>                         </ows:Constraint>                     </ows:Get>                 </ows:HTTP>             </ows:DCP>         </ows:Operation>         <ows:Operation name="GetTile">             <ows:DCP>                 <ows:HTTP>                     <ows:Get xlink:href="http://10.1.7.160:81/sla_c/wmts?">                         <ows:Constraint name="GetEncoding">                             <ows:AllowedValues>                                 <ows:Value>KVP</ows:Value>                             </ows:AllowedValues>                         </ows:Constraint>                     </ows:Get>                 </ows:HTTP>             </ows:DCP>         </ows:Operation>     </ows:OperationsMetadata>     <Contents>         <Layer>             <ows:Title>sla</ows:Title>             <ows:Abstract>sla</ows:Abstract>             <ows:Identifier>sla</ows:Identifier>             <ows:WGS84BoundingBox>                 <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>                 <ows:UpperCorner>180.0 90.0</ows:UpperCorner>             </ows:WGS84BoundingBox>             <ows:BoundingBox>                 <ows:LowerCorner>-180.0 -90.0</ows:LowerCorner>                 <ows:UpperCorner>180.0 90.0</ows:UpperCorner>             </ows:BoundingBox>             <Style>                 <ows:Identifier>default</ows:Identifier>             </Style>             <Format>tiles</Format>             <TileMatrixSetLink>                 <TileMatrixSet>c</TileMatrixSet>             </TileMatrixSetLink>         </Layer>         <TileMatrixSet>             <ows:Identifier>c</ows:Identifier>             <ows:SupportedCRS>urn:ogc:def:crs:EPSG::4490</ows:SupportedCRS>             <TileMatrix>                 <ows:Identifier>1</ows:Identifier>                 <ScaleDenominator>2.958293554545656E8</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>2</MatrixWidth>                 <MatrixHeight>1</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>2</ows:Identifier>                 <ScaleDenominator>1.479146777272828E8</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>4</MatrixWidth>                 <MatrixHeight>2</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>3</ows:Identifier>                 <ScaleDenominator>7.39573388636414E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>8</MatrixWidth>                 <MatrixHeight>4</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>4</ows:Identifier>                 <ScaleDenominator>3.69786694318207E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>16</MatrixWidth>                 <MatrixHeight>8</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>5</ows:Identifier>                 <ScaleDenominator>1.848933471591035E7</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>32</MatrixWidth>                 <MatrixHeight>16</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>6</ows:Identifier>                 <ScaleDenominator>9244667.357955175</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>64</MatrixWidth>                 <MatrixHeight>32</MatrixHeight>             </TileMatrix>                                 <TileMatrix>                 <ows:Identifier>7</ows:Identifier>                 <ScaleDenominator>4622333.678977588</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>128</MatrixWidth>                 <MatrixHeight>64</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>8</ows:Identifier>                 <ScaleDenominator>2311166.839488794</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>256</MatrixWidth>                 <MatrixHeight>128</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>9</ows:Identifier>                 <ScaleDenominator>1155583.419744397</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>512</MatrixWidth>                 <MatrixHeight>256</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>10</ows:Identifier>                 <ScaleDenominator>577791.7098721985</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>1024</MatrixWidth>                 <MatrixHeight>512</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>11</ows:Identifier>                 <ScaleDenominator>288895.85493609926</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>2048</MatrixWidth>                 <MatrixHeight>1024</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>12</ows:Identifier>                 <ScaleDenominator>144447.92746804963</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>4096</MatrixWidth>                 <MatrixHeight>2048</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>13</ows:Identifier>                 <ScaleDenominator>72223.96373402482</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>8192</MatrixWidth>                 <MatrixHeight>4096</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>14</ows:Identifier>                 <ScaleDenominator>36111.98186701241</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>16384</MatrixWidth>                 <MatrixHeight>8192</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>15</ows:Identifier>                 <ScaleDenominator>18055.990933506204</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>32768</MatrixWidth>                 <MatrixHeight>16384</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>16</ows:Identifier>                 <ScaleDenominator>9027.995466753102</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>65536</MatrixWidth>                 <MatrixHeight>32768</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>17</ows:Identifier>                 <ScaleDenominator>4513.997733376551</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>131072</MatrixWidth>                 <MatrixHeight>65536</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>18</ows:Identifier>                 <ScaleDenominator>2256.998866688275</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>262144</MatrixWidth>                 <MatrixHeight>131072</MatrixHeight>             </TileMatrix>             <TileMatrix>                 <ows:Identifier>19</ows:Identifier>                 <ScaleDenominator>1128.4994333441375</ScaleDenominator>                 <TopLeftCorner>90.0 -180.0</TopLeftCorner>                 <TileWidth>256</TileWidth>                 <TileHeight>256</TileHeight>                 <MatrixWidth>524288</MatrixWidth>                 <MatrixHeight>262144</MatrixHeight>             </TileMatrix>         </TileMatrixSet>     </Contents> </Capabilities>
  • 电子地图
    “`xml
    http://www.opengis.net/wmts/1.0 http://10.1.3.199:8092/iserver/services/map-ugcv5-ditu/wmts100/wmts,1.0,wmtsGetCapabilities_response.xsd”>
    示例 WMTS 服务 SuperMap iServer 基于示范数据发布的 WMTS 服务 iServer Sample Data OGC WMTS 1.0.0 none none
    北京超图软件股份有限公司 联系人姓名 联系人职位 +86-10-59896655 +86-10-59896666 北京市朝阳区酒仙桥北路甲10号院电子城IT产业园107号楼6层北京超图软件股份有限公司 北京 北京 100015 中国 support@supermap.com

    RESTFUL KVP application/xml




部分转自互联网,侵权删除联系

赞(0) 打赏
部分文章转自网络,侵权联系删除b2bchain区块链学习技术社区 » 解决leaflet加载基于超图平台发布的WMTS服务两个图层级别不一致问题求职学习资料
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

b2b链

联系我们联系我们