首页 / 浏览问题 / 云GIS / 问题详情
js 调用wmts报错
14EXP 2018年11月22日
1.wmts的功能文档如下
=======================================================
<Layer>
<ows:Title>clip4326@clip4326</ows:Title>
<ows:Identifier>clip4326@clip4326</ows:Identifier>
<ows:WGS84BoundingBox crs="urn:ogc:def:crs:OGC:2:84">
<ows:LowerCorner>112.556518495375 23.143859227089077</ows:LowerCorner>
<ows:UpperCorner>112.56988615340978 23.15423593926946</ows:UpperCorner>
</ows:WGS84BoundingBox>
<Style isDefault="true">
<ows:Identifier>default</ows:Identifier>
</Style>
<Format>image/png</Format>
<InfoFormat>application/xml</InfoFormat>
<TileMatrixSetLink>
<TileMatrixSet>Custom_clip4326@clip4326</TileMatrixSet>
</TileMatrixSetLink>
<ResourceURL format="image/png" resourceType="tile" template="http://localhost:8090/iserver/services/map-clip/wmts-DTD/clip4326%40clip4326/default/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png"/>
<ResourceURL format="application/xml" resourceType="FeatureInfo" template="http://localhost:8090/iserver/services/map-clip/wmts-DTD/clip4326%40clip4326/default/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml"/>
</Layer>
<TileMatrixSet>
<ows:Identifier>Custom_clip4326@clip4326</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4326</ows:SupportedCRS>
<WellKnownScaleSet>Custom</WellKnownScaleSet>
<!--
The dpi of current tile matrix set is 96.0,the following scales has calculated based on it.
-->
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>2.958293554545656E8</ScaleDenominator>
<!-- <Resolution>0.7031249999999999</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>1</ows:Identifier>
<ScaleDenominator>1.479146777272828E8</ScaleDenominator>
<!-- <Resolution>0.35156249999999994</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>2</ows:Identifier>
<ScaleDenominator>3.69786694318207E7</ScaleDenominator>
<!-- <Resolution>0.08789062499999999</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>3</ows:Identifier>
<ScaleDenominator>1.848933471591035E7</ScaleDenominator>
<!-- <Resolution>0.04394531249999999</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>4</ows:Identifier>
<ScaleDenominator>9244667.357955175</ScaleDenominator>
<!-- <Resolution>0.021972656249999997</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>5</ows:Identifier>
<ScaleDenominator>4622333.678977588</ScaleDenominator>
<!-- <Resolution>0.010986328125</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
'''''''''
<TileMatrix>
<ows:Identifier>17</ows:Identifier>
<ScaleDenominator>1128.4994333267211</ScaleDenominator>
<!-- <Resolution>2.6822090148511828E-6</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>20</MatrixWidth>
<MatrixHeight>16</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>18</ows:Identifier>
<ScaleDenominator>564.2497166633606</ScaleDenominator>
<!-- <Resolution>1.3411045074255914E-6</Resolution> -->
<TopLeftCorner>23.15423593926946 112.556518495375</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>39</MatrixWidth>
<MatrixHeight>31</MatrixHeight>
</TileMatrix>
</TileMatrixSet>
</Contents>
=============================================
2.js调用===============
var haininlayer3 = new SuperMap.Layer.WMTS({
    name: "clip4326@clip4326",
    url: "http://localhost:8090/iserver/services/map-clip/wmts-DTD",
    layer: "clip4326@clip4326",
    style: "default",
    matrixSet: "Custom_clip4326@clip4326",
    format: "image/png",
    isBaseLayer: false,
    resolutions: resolutions,
    matrixIds: matrixIds,
    opacity: 1,
    requestEncoding: "KVP"
});
map.addLayer(haininlayer3);
============================================
调的时候报错400
<Exception exceptionCode="TileOutOfRange" locator="tileRow">
<ExceptionText>
WMTS请求的瓦片不存在,瓦片的所在的矩阵集是Custom_clip4326@clip4326,所在的矩阵是的16,行号是12169,列号是53258
</ExceptionText>
</Exception>
<Exception exceptionCode="InvalidParameterValue" locator="tileRow">
<ExceptionText>在WMTS服务请求中,tileRow参数不合法</ExceptionText>
</Exception>
请问一下这是什么原因?

1个回答

请问您前端的resolutions设置是否和能力文档中的一致呢
1,076EXP 2018年11月22日
您好。不一致,应为这个resolutions在加载天地图的时候也用了,现在是想让两个叠加显示。
resolutions不同是拿不到图的,您这样的话肯定是叠加不上的,您如果要叠天地图,您可以自建一个服务接口,然后dpi和比例尺设置成和天地图的一致,然后重新发布服务选择你自定义的接口,或者您发布的时候选用wmts-china试一下,这个resolutions和部分天地图是一致的

您好,我是自己建了一个接口,dpi设置的96,比例尺设置的是功能文档中的<ScaleDenominator>的值

您这个比列尺有问题,这里填比例尺是比例尺的分母,不可能是2.9这么大,您可以直接用wmts-china接口
...