Cesium adds base map
cesiumConfig.baseLayer = new Cesium.ImageryLayer(new Cesium.WebMapTileServiceImageryProvider({
url: `${tdtUrl}img_c/wmts?tk=${tdt_tk}`,
layer: 'img',
style: 'default',
format: 'tiles',
tileMatrixSetID: 'c',
subdomains: subdomains,
maximumLevel: 18,
tilingScheme: new Cesium.GeographicTilingScheme(),
tileMatrixLabels: Array.from({ length: 18 }, (v, k) => k + 1),
}));
tileMatrixLabels: Array.from({ length: 18 }, (v, k) => k + 1),
Here+1 is because the layer of the sky map starts from 1, which is normal.
Using the wmts service published by Geoserver
viewer.scene.imageryLayers.add(
new Cesium.ImageryLayer(
new Cesium.WebMapTileServiceImageryProvider({
url: 'http://172.88.0.31:9090/geoserver/cloud/ht/gwc/service/wmts',
layer: 'ht:t_ds_imp_ynsbj_cn2k',
style: '',
tileMatrixSetID: 'CGCS2000',
format: 'image/png',
maximumLevel: 20,
rectangle: Cesium.Rectangle.fromDegrees(94.5, 21.11, 109.5, 29.3),
tileMatrixLabels: Array.from({ length: 20 }, (v, k) => `CGCS2000:${k + 1}`),
tilingScheme: new Cesium.GeographicTilingScheme()
})
)
);
Why does the tileMatrixLabels layer sent by Geoserver require+1 when using the same 2000 coordinate system? And my service started from scratch.
- geoserver GetCapabilities
<?xml version="1.0" encoding="UTF-8"?>
<Capabilities xmlns="http://www.opengis.net/wmts/1.0" xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gml="http://www.opengis.net/gml"
xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_response.xsd"
version="1.0.0">
<ows:ServiceIdentification>
<ows:Title>Web Map Tile Service - GeoWebCache</ows:Title>
<ows:Keywords />
<ows:ServiceType>OGC WMTS</ows:ServiceType>
<ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
</ows:ServiceIdentification>
<ows:ServiceProvider>
<ows:ServiceContact>
<ows:ContactInfo>
<ows:Address />
</ows:ContactInfo>
</ows:ServiceContact>
</ows:ServiceProvider>
<ows:OperationsMetadata>
<ows:Operation name="GetCapabilities">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://172.88.0.31:9090/geoserver/cloud/gwc/service/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://172.88.0.31:9090/geoserver/cloud/gwc/service/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="GetFeatureInfo">
<ows:DCP>
<ows:HTTP>
<ows:Get xlink:href="http://172.88.0.31:9090/geoserver/cloud/gwc/service/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>t_ds_imp_ynsbj_cn2k</ows:Title>
<ows:Identifier>ht:t_ds_imp_ynsbj_cn2k</ows:Identifier>
<Style isDefault="true">
<ows:Identifier>ht:province</ows:Identifier>
<LegendURL format="image/png"
xlink:href="http://172.88.0.31:9090/geoserver/cloud/ows?service=WMS&request=GetLegendGraphic&format=image%2Fpng&width=49&height=80&layer=ht%3At_ds_imp_ynsbj_cn2k"
width="49" height="80" minScaleDenominator="1.0" maxScaleDenominator="2.0E8" />
</Style>
<Format>image/png</Format>
<InfoFormat>text/plain</InfoFormat>
<InfoFormat>application/vnd.ogc.gml</InfoFormat>
<InfoFormat>text/xml</InfoFormat>
<InfoFormat>application/vnd.ogc.gml/3.1.1</InfoFormat>
<InfoFormat>text/xml</InfoFormat>
<InfoFormat>text/html</InfoFormat>
<InfoFormat>application/json</InfoFormat>
<TileMatrixSetLink>
<TileMatrixSet>CGCS2000</TileMatrixSet>
<TileMatrixSetLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:0</TileMatrix>
<MinTileRow>0</MinTileRow>
<MaxTileRow>0</MaxTileRow>
<MinTileCol>0</MinTileCol>
<MaxTileCol>0</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:1</TileMatrix>
<MinTileRow>0</MinTileRow>
<MaxTileRow>0</MaxTileRow>
<MinTileCol>1</MinTileCol>
<MaxTileCol>1</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:2</TileMatrix>
<MinTileRow>0</MinTileRow>
<MaxTileRow>0</MaxTileRow>
<MinTileCol>3</MinTileCol>
<MaxTileCol>3</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:3</TileMatrix>
<MinTileRow>1</MinTileRow>
<MaxTileRow>1</MaxTileRow>
<MinTileCol>6</MinTileCol>
<MaxTileCol>6</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:4</TileMatrix>
<MinTileRow>2</MinTileRow>
<MaxTileRow>3</MaxTileRow>
<MinTileCol>12</MinTileCol>
<MaxTileCol>12</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:5</TileMatrix>
<MinTileRow>5</MinTileRow>
<MaxTileRow>6</MaxTileRow>
<MinTileCol>24</MinTileCol>
<MaxTileCol>25</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:6</TileMatrix>
<MinTileRow>10</MinTileRow>
<MaxTileRow>12</MaxTileRow>
<MinTileCol>49</MinTileCol>
<MaxTileCol>50</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:7</TileMatrix>
<MinTileRow>21</MinTileRow>
<MaxTileRow>24</MaxTileRow>
<MinTileCol>98</MinTileCol>
<MaxTileCol>101</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:8</TileMatrix>
<MinTileRow>43</MinTileRow>
<MaxTileRow>48</MaxTileRow>
<MinTileCol>197</MinTileCol>
<MaxTileCol>203</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:9</TileMatrix>
<MinTileRow>86</MinTileRow>
<MaxTileRow>97</MaxTileRow>
<MinTileCol>394</MinTileCol>
<MaxTileCol>407</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:10</TileMatrix>
<MinTileRow>172</MinTileRow>
<MaxTileRow>195</MaxTileRow>
<MinTileCol>789</MinTileCol>
<MaxTileCol>814</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:11</TileMatrix>
<MinTileRow>345</MinTileRow>
<MaxTileRow>391</MaxTileRow>
<MinTileCol>1578</MinTileCol>
<MaxTileCol>1628</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:12</TileMatrix>
<MinTileRow>691</MinTileRow>
<MaxTileRow>783</MaxTileRow>
<MinTileCol>3157</MinTileCol>
<MaxTileCol>3256</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:13</TileMatrix>
<MinTileRow>1382</MinTileRow>
<MaxTileRow>1566</MaxTileRow>
<MinTileCol>6315</MinTileCol>
<MaxTileCol>6512</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:14</TileMatrix>
<MinTileRow>2765</MinTileRow>
<MaxTileRow>3133</MaxTileRow>
<MinTileCol>12630</MinTileCol>
<MaxTileCol>13025</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:15</TileMatrix>
<MinTileRow>5531</MinTileRow>
<MaxTileRow>6267</MaxTileRow>
<MinTileCol>25261</MinTileCol>
<MaxTileCol>26050</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:16</TileMatrix>
<MinTileRow>11063</MinTileRow>
<MaxTileRow>12535</MaxTileRow>
<MinTileCol>50522</MinTileCol>
<MaxTileCol>52100</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:17</TileMatrix>
<MinTileRow>22127</MinTileRow>
<MaxTileRow>25070</MaxTileRow>
<MinTileCol>101044</MinTileCol>
<MaxTileCol>104201</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:18</TileMatrix>
<MinTileRow>44254</MinTileRow>
<MaxTileRow>50140</MaxTileRow>
<MinTileCol>202089</MinTileCol>
<MaxTileCol>208402</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:19</TileMatrix>
<MinTileRow>88508</MinTileRow>
<MaxTileRow>100281</MaxTileRow>
<MinTileCol>404178</MinTileCol>
<MaxTileCol>416804</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:20</TileMatrix>
<MinTileRow>177017</MinTileRow>
<MaxTileRow>200563</MaxTileRow>
<MinTileCol>808357</MinTileCol>
<MaxTileCol>833609</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:21</TileMatrix>
<MinTileRow>354035</MinTileRow>
<MaxTileRow>401126</MaxTileRow>
<MinTileCol>1616715</MinTileCol>
<MaxTileCol>1667218</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:22</TileMatrix>
<MinTileRow>708071</MinTileRow>
<MaxTileRow>802252</MaxTileRow>
<MinTileCol>3233430</MinTileCol>
<MaxTileCol>3334436</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:23</TileMatrix>
<MinTileRow>1416142</MinTileRow>
<MaxTileRow>1604505</MaxTileRow>
<MinTileCol>6466860</MinTileCol>
<MaxTileCol>6668872</MaxTileCol>
</TileMatrixLimits>
<TileMatrixLimits>
<TileMatrix>CGCS2000:24</TileMatrix>
<MinTileRow>2832284</MinTileRow>
<MaxTileRow>3209010</MaxTileRow>
<MinTileCol>12933721</MinTileCol>
<MaxTileCol>13337745</MaxTileCol>
</TileMatrixLimits>
</TileMatrixSetLimits>
</TileMatrixSetLink>
<ResourceURL format="image/png" resourceType="tile"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}?format=image/png" />
<ResourceURL format="text/plain" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=text/plain" />
<ResourceURL format="application/vnd.ogc.gml" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=application/vnd.ogc.gml" />
<ResourceURL format="text/xml" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=text/xml" />
<ResourceURL format="application/vnd.ogc.gml/3.1.1" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=application/vnd.ogc.gml/3.1.1" />
<ResourceURL format="text/xml" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=text/xml" />
<ResourceURL format="text/html" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=text/html" />
<ResourceURL format="application/json" resourceType="FeatureInfo"
template="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/ht:t_ds_imp_ynsbj_cn2k/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}?format=application/json" />
</Layer>
<TileMatrixSet>
<ows:Identifier>CGCS2000</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::4490</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>CGCS2000:0</ows:Identifier>
<ScaleDenominator>5.590822640287176E8</ScaleDenominator>
<TopLeftCorner>270.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:1</ows:Identifier>
<ScaleDenominator>2.795411320143588E8</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>2</MatrixWidth>
<MatrixHeight>1</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:2</ows:Identifier>
<ScaleDenominator>1.397705660071794E8</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>4</MatrixWidth>
<MatrixHeight>2</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:3</ows:Identifier>
<ScaleDenominator>6.988528300358969E7</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>8</MatrixWidth>
<MatrixHeight>4</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:4</ows:Identifier>
<ScaleDenominator>3.494264150179486E7</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>16</MatrixWidth>
<MatrixHeight>8</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:5</ows:Identifier>
<ScaleDenominator>1.747132075089743E7</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>32</MatrixWidth>
<MatrixHeight>16</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:6</ows:Identifier>
<ScaleDenominator>8735660.375448715</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>64</MatrixWidth>
<MatrixHeight>32</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:7</ows:Identifier>
<ScaleDenominator>4367830.1877243575</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>128</MatrixWidth>
<MatrixHeight>64</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:8</ows:Identifier>
<ScaleDenominator>2183915.0938621787</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>256</MatrixWidth>
<MatrixHeight>128</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:9</ows:Identifier>
<ScaleDenominator>1091957.5469310894</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>512</MatrixWidth>
<MatrixHeight>256</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:10</ows:Identifier>
<ScaleDenominator>545978.7734655447</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1024</MatrixWidth>
<MatrixHeight>512</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:11</ows:Identifier>
<ScaleDenominator>272989.38673277234</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>2048</MatrixWidth>
<MatrixHeight>1024</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:12</ows:Identifier>
<ScaleDenominator>136494.69336636632</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>4096</MatrixWidth>
<MatrixHeight>2048</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:13</ows:Identifier>
<ScaleDenominator>68247.34668318316</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>8192</MatrixWidth>
<MatrixHeight>4096</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:14</ows:Identifier>
<ScaleDenominator>34123.67334161145</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>16384</MatrixWidth>
<MatrixHeight>8192</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:15</ows:Identifier>
<ScaleDenominator>17061.836670805726</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>32768</MatrixWidth>
<MatrixHeight>16384</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:16</ows:Identifier>
<ScaleDenominator>8530.918335382985</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>65536</MatrixWidth>
<MatrixHeight>32768</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:17</ows:Identifier>
<ScaleDenominator>4265.45916771137</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>131072</MatrixWidth>
<MatrixHeight>65536</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:18</ows:Identifier>
<ScaleDenominator>2132.729583855685</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>262144</MatrixWidth>
<MatrixHeight>131072</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:19</ows:Identifier>
<ScaleDenominator>1066.3647919278426</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>524288</MatrixWidth>
<MatrixHeight>262144</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:20</ows:Identifier>
<ScaleDenominator>533.1823959440429</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>1048576</MatrixWidth>
<MatrixHeight>524288</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:21</ows:Identifier>
<ScaleDenominator>266.59119797202146</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>2097152</MatrixWidth>
<MatrixHeight>1048576</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:22</ows:Identifier>
<ScaleDenominator>133.2955990058892</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>4194304</MatrixWidth>
<MatrixHeight>2097152</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:23</ows:Identifier>
<ScaleDenominator>66.64779948306612</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>8388608</MatrixWidth>
<MatrixHeight>4194304</MatrixHeight>
</TileMatrix>
<TileMatrix>
<ows:Identifier>CGCS2000:24</ows:Identifier>
<ScaleDenominator>33.32389974153306</ScaleDenominator>
<TopLeftCorner>90.0 -180.0</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>16777216</MatrixWidth>
<MatrixHeight>8388608</MatrixHeight>
</TileMatrix>
</TileMatrixSet>
</Contents>
<ServiceMetadataURL
xlink:href="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts?SERVICE=wmts&REQUEST=getcapabilities&VERSION=1.0.0" />
<ServiceMetadataURL
xlink:href="http://172.88.0.31:9090/geoserver/cloud/gwc/service/wmts/rest/WMTSCapabilities.xml" />
</Capabilities>
- All layers must be+1 in order to display properly. If you don’t add 1, it will display like this
Full Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://cdn.bootcdn.net/ajax/libs/cesium/1.123.0/Cesium.js"></script>
<link href="https://cdn.bootcdn.net/ajax/libs/cesium/1.123.0/Widgets/widgets.css" rel="stylesheet" />
</head>
<body>
<div id="map"></div>
</body>
<script>
// 替换默认的坐标系为CGCS2000
Cesium.Ellipsoid.CGCS2000 = Object.freeze(
// eslint-disable-next-line no-loss-of-precision
new Cesium.Ellipsoid(6378137.0, 6378137.0, 6356752.31414035585)
);
Cesium.Ellipsoid.WGS84 = Cesium.Ellipsoid.CGCS2000;
Cesium.Ellipsoid._default = Cesium.Ellipsoid.CGCS2000;
let cesiumConfig = {
animation: false,
baseLayerPicker: false,
fullscreenButton: false,
geocoder: false,
homeButton: false,
infoBox: false,
sceneModePicker: false,
scene3DOnly: true,
selectionIndicator: false,
timeline: false,
navigationHelpButton: false,
baselLayerPicker: false,
shadows: false,
shouldAnimate: false,
vrButton: false,
requestRenderMode: true,
mapProjection: new Cesium.GeographicProjection(Cesium.Ellipsoid.CGCS2000),
contextOptions: {
webgl: {
alpha: true,
depth: false,
stencil: true,
antialias: true,
premultipliedAlpha: true,
preserveDrawingBuffer: true,
failIfMajorPerformanceCaveat: true
},
allowTextureFilterAnisotropic: true
},
};
let tdtUrl = 'https://t{s}.tianditu.gov.cn/';
let subdomains = [1, 2, 3, 4, 5, 6, 7];
let tdt_tk = '5d22d49fdc586cb5caed68bfb12d1e6b';
// 经纬度投影
cesiumConfig.baseLayer = new Cesium.ImageryLayer(new Cesium.WebMapTileServiceImageryProvider({
url: `${tdtUrl}img_c/wmts?tk=${tdt_tk}`,
layer: 'img',
style: 'default',
format: 'tiles',
tileMatrixSetID: 'c',
subdomains: subdomains,
maximumLevel: 18,
tilingScheme: new Cesium.GeographicTilingScheme(),
tileMatrixLabels: Array.from({ length: 18 }, (v, k) => k + 1),
}));
let cesiumBox = document.getElementById('map');
let viewer = new Cesium.Viewer(cesiumBox, cesiumConfig);
Cesium.CesiumTerrainProvider.fromUrl('https://t6.tianditu.gov.cn/mapservice/GetTiles?lxys=2,3,1&VERSION=1.0.0&tk=5d22d49fdc586cb5caed68bfb12d1e6b', {
requestWaterMask: true,
requestVertexNormals: true,
}).then(terrainProvider => {
viewer.terrainProvider = terrainProvider;
});
// 添加我的图层
viewer.scene.imageryLayers.add(
new Cesium.ImageryLayer(
new Cesium.WebMapTileServiceImageryProvider({
url: 'http://172.88.0.31:9090/geoserver/cloud/ht/gwc/service/wmts',
layer: 'ht:t_ds_imp_ynsbj_cn2k',
style: '',
tileMatrixSetID: 'CGCS2000',
format: 'image/png',
maximumLevel: 20,
rectangle: Cesium.Rectangle.fromDegrees(94.5, 21.11, 109.5, 29.3),
tileMatrixLabels: Array.from({ length: 20 }, (v, k) => `CGCS2000:${k + 1}`),
tilingScheme: new Cesium.GeographicTilingScheme()
})
)
);
</script>
<style>
html,
body,
#map {
width: 100%;
height: 100vh;
margin: 0;
padding: 0;
}
</style>
</html>
issue
- May I ask what caused the newly added layer offset?
- Why do we all need to add 1?