WMTS—OGC Web地图平铺服务

司机简称

WMTS

2.1 新版功能.

生成依赖项

利勃曲尔

使用GDAL WMTS客户端驱动程序可以访问WMTS层(需要Curl支持)。它同时支持RESTful和KVP协议。

驱动程序功能

Supports Georeferencing

This driver supports georeferencing

Supports VirtualIO

This driver supports virtual I/O operations (/vsimem/, etc.)

开放语法

WMTS驱动程序可以打开:

  • 本地服务描述XML文件,其语法在下面一节中描述:

    gdalinfo gdal_wmts.xml
    
  • 作为文件名提供的描述XML文件的内容:

    gdalinfo "<GDAL_WMTS><GetCapabilitiesUrl>http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml</GetCapabilitiesUrl><Layer>lb</Layer></GDAL_WMTS>"
    
  • WMTS服务的本地GetCapabilities响应:

    gdalinfo WMTSCapabilities.xml
    
  • WMTS服务的GetCapabilities响应的URL:

    gdalinfo "http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml"
    
  • WMTS服务的GetCapabilities响应的URL,前缀为 气象卫星: ,可能还有可选的layer、tilematrixset、tilematrix/zoom_level、style和extendedbeyonddateline参数,语法如下 [WMTS:url[,layer=layer_id][,tilematrixset=tms_id][,tilematrix=tm_id|,zoom_level=level][,style=style_id][,extendbeyonddateline=yes/no]] .

    gdalinfo "WMTS:http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml"
    
    gdalinfo "WMTS:http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml,layer=lb"
    
  • the WMTS: prefix with open options

    gdalinfo WMTS: -oo URL=http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml -oo LAYER=lb
    

在上述任何语法中,如果存在多个层,并且没有使用layer parameter/open选项进行层消歧,或者如果一个层有多个样式或一个tile矩阵集,则将返回子数据集列表。如果只有一个图层,则将在默认样式和列出的第一个平铺矩阵集上打开该图层。

打开选项

以下打开选项可用:

  • URL: URL (or filename for local files) to GetCapabilities response document. Required if not specified in the connection string (e.g if using "WMTS:" only)

  • LAYER: Layer identifier

  • TILEMATRIXSET: Tile Matrix Set identifier, which determines the CRS into which the layer will be exposed. Must be one of the listed tile matrix for the layer.

  • TILEMATRIX: Tile Matrix identifier. Must be one of the listed tile matrix of the select tile matrix set for the layer. Mutually exclusive with ZOOM_LEVEL. If not specified the last tile matrix, i.e. the one with the best resolution, is selected.

  • ZOOM_LEVEL: Index of the maximum zoom level tile matrix to use for the full resolution GDAL dataset (lower zoom levels will be used for overviews). The first one (ie the one of lower resolution) is indexed 0. Mutually exclusive with TILEMATRIX. If not specified the last tile matrix, i.e. the one with the best resolution, is selected.

  • STYLE: Style identifier. Must be one of layer.

  • EXTENDBEYONDDATELINE = YES/NO. Whether to make the extent go over dateline and warp tile requests. See ExtendBeyondDateLine parameter of the local service description XML file described below for more details.

  • EXTENT_METHOD = AUTO/LAYER_BBOX/TILE_MATRIX_SET/MOST_PRECISE_TILE_MATRIX. GDAL needs to retrieve an extent for the layer. Different sources are possible. WGS84BoundingBox element at the Layer level, BoundingBox elements with potentially several CRS at the Layer level, BoundingBox of the TileMatrixSet definitions shared by all layers, and TileMatrixLimit definitions at the Layer level. By default (AUTO), GDAL will try first with a WGS84BoundingBox/BoundingBox corresponding to the CRS implied by the select TileMatrixSet. If not available, if will fallback to a BoundingBox in another CRS and reproject it to the selected CRS. If not available, it will fallback to the most precise tile matrix of the selected TileMatrixSet and will clip it with the bounding box implied by the most precise zoom level of the TileMatrixLimit of the layer. If LAYER_BBOX is specified, only WGS84BoundingBox/BoundingBox elements are considered. If TILE_MATRIX_SET is specified, the BoundingBox element of the selected TileMatrixSet will be used. If MOST_PRECISE_TILE_MATRIX is specified, the implit extent of the most precise tile matrix will be used.

  • CLIP_EXTENT_WITH_MOST_PRECISE_TILE_MATRIX = YES/NO (GDAL >= 3.4.2). Whether to use the implied bounds of the most precise TileMatrix to clip the layer extent (defaults to NO if the layer bounding box is used, YES otherwise)

  • CLIP_EXTENT_WITH_MOST_PRECISE_TILE_MATRIX_LIMITS = YES/NO (GDAL >= 3.4.2). Whether to use the implied bounds of the most precise TileMatrixLimit to clip the layer extent (defaults to NO if the layer bounding box is used, YES otherwise)

本地服务描述XML文件

重要的是在 <GDAL_WMTS> 元素。

<GDAL_WMTS>

<GetCapabiliti esUrl>http://foo/WM TSCapabilities.xml</GetCapabiliti esUrl>

获取功能响应文档的URL(或本地文件的文件名)(必需)。对于仅KVP的服务器,将类似于http://end_point?服务=WMTS&REQUEST=GetCapabilities。

<Layer>layer_id</Layer>

层标识符(可选,但可能需要在多个层之间消除歧义)

<Style>style_id</Style>

样式标识符。必须是列出的图层样式之一。(可选,但可能需要消除几种样式之间的歧义)

<tile matrix set>tile矩阵集id</TileMatrixSet>

平铺矩阵集标识符。必须是列出的层的平铺矩阵集之一。(可选,但可能需要消除多个平铺矩阵集之间的歧义)

<tile matrix>平铺矩阵id</TileM atrix>

平铺矩阵标识符。必须是为层设置的选定平铺矩阵集的列表平铺矩阵之一。(可选,GDAL>=2.2。与ZoomLevel独家合作。如果未指定,则选择最后一个平铺矩阵(即具有最佳分辨率的矩阵)

<ZoomLevel>int_value</ZoomLevel>

要使用的最大缩放级别/平铺矩阵的索引。第一个(即分辨率较低的那个)索引为0。(可选,GDAL>=2.2。TileMatrix独家提供。如果未指定,则选择最后一个平铺矩阵(即具有最佳分辨率的矩阵)

<Format>图像/png</Format>

Tile格式,由GetTile请求使用。必须是列出的图层格式之一。(可选,但可能需要消除几种格式之间的歧义)

<Info Format>应用程序/xml</Info Format>

信息格式,由GetFeatureInfo请求使用。必须是列出的图层信息格式之一。(可选,但可能需要消除几种信息格式之间的歧义)

<DataWindow>

定义数据的范围。(可选,未指定时,驱动程序将查询层的声明范围,如果不存在,则回退到选择平铺矩阵集的范围,同时考虑到潜在的平铺矩阵集限制)

<UpperLeftX>-180.0</UpperLeftX>

左上角的X(经度/东距)坐标,位于平铺矩阵集的SRS中。(如果存在数据窗口,则为必需)

<UpperLeftY>90.0</UpperLeftY>

左上角的Y(纬度/北距)坐标,位于平铺矩阵集的SRS中。(如果存在数据窗口,则为必需)

<LowerRightX>180.0</LowerRightX>

右下角的X(经度/东距)坐标,位于平铺矩阵集的SRS中。(如果存在数据窗口,则为必需)

<LowerRightY>-90.0</LowerRightY>

右下角的Y(纬度/北距)坐标,位于平铺矩阵集的SRS中。(如果存在数据窗口,则为必需)

</DataWindow>

<Projection>EPSG:4326</Projection>

声明的投影,以防其中一个TileMatrixSet不可取(可选,默认为TileMatrixSet的值)

<BandsCount>4</BandsCount>

波段/通道数,1表示灰度数据,3表示RGB,4表示RGBA。(可选,默认为4)

<DataType>字节</DataType>

波段数据类型,其中之一:Byte、Int16、UInt16、Int32、UInt32、Float32、Float64等。。(可选,默认为Byte)

<Exte ndBeyondDateLine>false</Exte ndBeyondDateLine>

是否使扩展数据块超过日期线并扭曲磁贴请求。仅当满足以下两个条件时适用(可选,默认为false):

  • 对于大地SRS或EPSG:3857,具有诸如 [-180,180] 经度范围完全由整数个瓷砖覆盖(例如GoogleMapsCompatible)。

  • AND

    • 当瓷砖矩阵集的SRS中的层边界框覆盖整个 [-180,180] 经度范围,并且在另一个SRS中有另一个边界框,该边界框以经度180为中心。如果GetCapabilities文档中不存在这样的备用绑定框,则必须显式指定DataWindow

    • 或者当平铺矩阵集的SRS中的层边界框超出日期线时。

<缓存>

Enable local disk cache. Allows for offline operation. (optional, cache is disabled when absent, but it is present in the autogenerated XML, can be overridden with GDAL_ENABLE_WMS_CACHE=NO

<Path>./gdalwmscache</Path>

Location where to store cache files. It is safe to use same cache path for different data sources. (optional, defaults to ./gdalwmscache if GDAL_DEFAULT_WMS_CACHE_PATH configuration option is not specified) /vsimem/ paths are supported allowing for temporary in-memory cache

<Type>文件</Type>

Cache type. Now supported only 'file' type. In 'file' cache type files are stored in file system folders. (optional, defaults to 'file')

<Depth>2</Depth>

目录层的数量。2将导致文件被写入缓存路径/A/B/ABCDEF。。。(可选,默认为2)

<Extension>.jpg</Extension>

附加到缓存文件。(可选,默认为无)

</Cache>

<MaxConnections>2</MaxConnections>

同时连接的最大数目。(可选,默认为2)

<Timeout>300</Timeout>

连接超时(秒)。(可选,默认为300)

<OfflineMode>true</OfflineMode>

不要下载任何新图像,只使用缓存中的内容。仅在启用缓存时才有用。(可选,默认为false)

<UserAgent>GDAL WMS驱动程序(http://www.GDAL.org/frmt_WMS.htm l)</UserAgent>

HTTP用户代理字符串。有些服务器可能需要著名的用户代理,如“Mozilla/5.0”(可选,默认为“GDAL WMS driver(http://www.GDAL.org/frmt_WMS.htm l)”)。

<UserPwd>用户:密码

用于HTTP身份验证的用户和密码(可选)。

<UnsafeSSL>true</UnsafeSSL>

跳过SSL证书验证。如果服务器使用自签名证书(可选,默认为false,但在自动生成的XML中设置为true),则可能需要使用该证书。

<Ref erer>http://example.foo/</Ref erer>

HTTP引用字符串。有些服务器可能需要它(可选)。

<zeroblockhttpcode>204404</Zero blockhttpcode>

以逗号分隔的HTTP响应代码列表,将被解释为0填充的图像(即3个波段为黑色,4个波段为透明),而不是中止请求。(可选,默认为未设置,但在自动生成的XML中设置为204404)

<ZeroBlockOnServerException>true</ZeroBlockOnServerException>

是否将服务器返回的服务异常视为0填充的映像,而不是中止请求。(可选,默认为false,但在自动生成的XML中设置为true)

</GDAL_WMTS>

从gdal2.3开始,可以通过将GDALuhttpuheaderu FILE配置选项设置为指向带有“key:value”HTTP头的文本文件的文件名来发送额外的HTTP头。

GetFeatureInfo请求

可以使用gdallocationinfo实用程序(通过GetFeatureInfo请求)查询WMTS层,也可以使用带区对象上的GetMetadataItem(“Pixel_iCol_iLine”,“LocationInfo”)调用查询WMTS层。

gdallocationinfo my_wmts.xml -geoloc -11547071.455 5528616 -xml -b 1

WMTS服务描述XML文件的生成

仅当源数据集本身是WMTS数据集时,才能手动生成WMTS服务描述XML文件,或将其创建为WMTS驱动程序的CreateCopy()操作的输出。否则,可以将gdal_translate与“Open syntax”中提到的任何上述语法一起用作源数据集,并作为XML文件的输出。例如:

gdal_translate "WMTS:http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml,layer=lb" wmts.xml -of WMTS

生成以下文件:

<GDAL_WMTS>
  <GetCapabilitiesUrl>http://maps.wien.gv.at/wmts/1.0.0/WMTSCapabilities.xml</GetCapabilitiesUrl>
  <Layer>lb</Layer>
  <Style>farbe</Style>
  <TileMatrixSet>google3857</TileMatrixSet>
  <DataWindow>
    <UpperLeftX>1800035.8827671</UpperLeftX>
    <UpperLeftY>6161931.622311067</UpperLeftY>
    <LowerRightX>1845677.148953537</LowerRightX>
    <LowerRightY>6123507.385072636</LowerRightY>
  </DataWindow>
  <BandsCount>4</BandsCount>
  <Cache />
  <UnsafeSSL>true</UnsafeSSL>
  <ZeroBlockHttpCodes>404</ZeroBlockHttpCodes>
  <ZeroBlockOnServerException>true</ZeroBlockOnServerException>
</GDAL_WMTS>

生成的文件将带有您可能需要编辑的默认值。

也见