GDAL可以通过xml文件定义调用WMTS的地图,具体说明请看:
https://gdal.org/drivers/raster/wmts.html#raster-wmts
下面是美国地质调查局两个WMTS地图的xml描述文件内容,可以供GDAL调用,在QGIS可以直接打开xml文件,就得到图像图层。
<GDAL_WMTS>
<GetCapabilitiesUrl>https://basemap.nationalmap.gov/arcgis/rest/services/USGSImageryOnly/MapServer/WMTS/1.0.0/WMTSCapabilities.xml</GetCapabilitiesUrl>
<Layer>USGSImageryOnly</Layer>
<Style>default</Style>
<TileMatrixSet>default028mm</TileMatrixSet>
<DataWindow>
<UpperLeftX>-19286101.78762695</UpperLeftX>
<UpperLeftY>11577829.95749197</UpperLeftY>
<LowerRightX>16266591.37317006</LowerRightX>
<LowerRightY>-1617574.307337267</LowerRightY>
</DataWindow>
<BandsCount>4</BandsCount>
<Cache />
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>204,404</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<Caliper>
<SortOrder>7</SortOrder>
</Caliper>
</GDAL_WMTS>
<GDAL_WMTS>
<GetCapabilitiesUrl>https://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml</GetCapabilitiesUrl>
<Layer>USGSTopo</Layer>
<Style>default</Style>
<TileMatrixSet>default028mm</TileMatrixSet>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
</DataWindow>
<BandsCount>4</BandsCount>
<Cache />
<UnsafeSSL>true</UnsafeSSL>
<ZeroBlockHttpCodes>204,404</ZeroBlockHttpCodes>
<ZeroBlockOnServerException>true</ZeroBlockOnServerException>
<Caliper>
<SortOrder>8</SortOrder>
<AdjustZoom>1</AdjustZoom>
</Caliper>
</GDAL_WMTS>
天地图也是WMTS,如何写出类似的XML文件?
下面是一些参考信息:
(1)元数据查询
http://t0.tianditu.gov.cn/vec_w/wmts?request=GetCapabilities&service=wmts
(2)地图瓦片获取
http://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={x}&TILECOL={y}&tk=您的密钥
(3)QGIS XYZ Tiles调用
https://t0.tianditu.gov.cn/vec_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=您的密钥
(4)QGIS WMTS调用
https://t0.tianditu.gov.cn/vec_w/wmts? tk=您的密钥
请专家回复,谢谢!