WMTS-运营

背景

历史

WMTS规范1.0.0版(“WMTS规范”) 07-057r7 OpenGIS Web Map Tile Service Implementation Standard 于2010年出版 Web Map Tile Service Simple Profile 2016年出版。

版本

1.0.0是当前最新版本。

测试套件

测试版 OGC Web Map Tile Service 1.0.0-可执行测试套件 截至2017年7月提供。更新可以在 `OGC合规计划可用的测试和路线图<http://cite.opengeospatial.org/roadmap>`_

启动位置

有关WMTS的信息 `OGC实施统计<http://www.opengeospatial.org/resource/products/byspec>`_

使用

  • WMTS提供了一个基于标准的解决方案来使用预定义的图像块来服务于数字地图。该服务通过所有ogcweb服务通用的servicetadata文档中的标准化声明来公布它所拥有的分片。该声明定义了每层(即,每种内容类型)、每种图形表示样式、每种格式、每种坐标参考系、每种比例尺以及总覆盖面积的每个地理片段上可用的分幅。ServiceMetadata文档还声明了客户机与服务器进行交互的通信协议和编码。ServiceTiles可以解释特定于文档的元数据。

  • WMTS的建立是为了帮助开发可扩展的、高性能的基于web的地图分发服务。它提供了一种标准化的方法来声明可以从服务器请求的映像,从而可以为所有服务器开发单一的客户机类型。它可以适应面向资源(类似REST)和面向过程的体系结构样式(KVP和SOAP编码)。

与其他OGC标准的关系

  • WMTS补充了OGC Web Map Service界面标准 (WMS) 用于基于网络的地图分发。WMS注重客户端请求的灵活性,使客户端能够准确地获得他们想要的最终图像。虽然WMS专注于渲染自定义地图,并且非常适合于动态数据或自定义样式的地图,但WMTS在提供静态数据(基础地图)时,将自定义地图渲染的灵活性与可伸缩性进行了权衡,因为静态数据(底图)的边界框和比例被限制为离散的分幅。固定的tile集允许使用只返回现有文件的web服务器实现WMTS服务。固定的tile集还支持使用标准网络机制来实现可伸缩性,例如分布式缓存系统。WMS服务器也可以用作WMTS服务的数据源或呈现引擎。

  • 客户端还可以请求使用特定的服务器播发样式来呈现映射层,甚至可以在WMS服务器实现OGC时使用客户端提供的样式 Styled Layer Descriptor (SLD) standard

  • OGC Web功能服务接口标准 (WFS) 更适合于空间数据的扩展查询功能。它提供对地理要素数据的编程访问。同时发布WMS和WFS的组织通常使用相同的数据源。

WMTS操作和资源概述

WMTS规范(“WMTS规范”) `07-057r7 OpenGIS Web地图图块服务实施标准<http://www.opengeospatial.org/standards/wmts>`_ 所请求的资源和服务器所提供的符合语义。它指定了ServiceMetadata文档、Tile图像或表示形式的语义,以及提供特定位置地图描述的可选FeatureInfo文档的语义。

WMTS规范在两种不同的体系结构样式下指定了客户机-服务器交换机制。在第一种“面向过程”的样式下,GetCapabilities、GetTile和(可选)GetFeatureInfo操作的请求和响应使用带有“普通旧XML”(POX)响应或嵌入在SOAP信封中的XML消息的键值对(KVP)请求的编码。

在第二种“面向资源”的样式下,指定了请求机制和端点发布策略,以支持与 REpresentational State Transfer (REST) . 这种方法基于web URL端点,使客户端能够直接访问ServiceMetadata、Tile和FeatureInfo资源作为文档。请求在URL本身中是隐式的。

在面向资源的风格下,通过预渲染图像,只依赖普通web服务器返回静态服务元数据XML文档并提供图像平铺文件,可以完全不使用图像处理逻辑来创建可伸缩的WMTS服务。HTTP协议将这些图像视为标准的web资源,提供者可以利用其现有的技术来改进这些资源向请求客户端的流动。

无论使用哪种样式,支持WMTS的服务通常都可以通过将映射划分为可快速返回的各个分片来提供性能和可伸缩性方面的优势。性能可以通过使用本地存储的、预渲染的分片来提高,这些分片不需要任何图像处理或地理处理。使用基于tile的映射,服务器能够处理对tile的异步访问是很重要的,因为大多数客户机将同时请求多个tile来填充一个视图。

WMTS接口允许客户端检索三种一般类型的资源:

服务元数据资源

在兼容的实现中需要ServiceMetadata资源(在面向资源的样式下直接访问,或者在面向过程的样式下响应GetCapabilities操作)。它描述了特定服务器实现的能力和信息持有量。

平铺资源

在兼容的实现中需要Tile资源(直接在面向资源的样式下访问,或者在面向过程的样式下响应GetTile操作)。它显示了一个图层的地图表示的片段。

FeatureInfo资源

FeatureInfo资源(直接在面向资源的样式下访问或响应面向过程的样式下的GetFeatureInfo操作)是可选的。它提供有关位于分幅地图的特定像素处的要素的信息。它的方式类似于WMS GetFeatureInfo操作,例如,以文本形式提供主题属性名称和值对。

WMTS为地图的单个图层提供单个分幅。如下图所示,分片在一个称为“分片矩阵集”的层次结构中相关,其中粗分辨率分片更接近顶部,而较精细分辨率分片更靠近底部。

../../_images/Tiles.png

与WMS不同,没有指定的方法来请求服务器在一次检索中组合并返回来自多个层的信息的地图分幅。想要显示层组合的WMTS客户端必须对层平铺发出独立的请求,然后组合或覆盖响应。此外,这些WMTS分幅的边界框和比例被约束为一组离散的值。

可在WMTS规范第6.1条中找到对平铺空间几何结构的完整解释。

检索ServiceMetadata的示例

GetCapabilities请求示例

在面向过程的样式下,WMTS客户机可以以下列方式调用kvpservicemetadata请求。这个例子改编自OGC的wmts1.0.0参考实现 Compliance Testing GitHub Wiki <https://github.com/opengeospatial/cite/wiki/Reference-Implementations> .

https://cite.deegree.org/deegree-webservices-3.5.0/services/wmts100?
service=WMTS&
request=GetCapabilities

使用SOAP的同一请求将具有以下形式:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <GetCapabilities xmlns="http://www.opengis.net/wmts/1.0"
      xmlns:ows="http://www.opengis.net/ows/1.1"
      xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetCapabilities_request.xsd"
      service="WMTS">
      <ows:AcceptVersions>
        <ows:Version>1.0.0</ows:Version>
      </ows:AcceptVersions>
      <ows:AcceptFormats>
        <ows:OutputFormat>application/xml</ows:OutputFormat>
      </ows:AcceptFormats>
    </GetCapabilities>
  </soap:Body>
</soap:Envelope>

在面向资源的风格下,一个典型的例子可能是:

http://cite.deegree.org/1.0.0/WMTSCapabilities.xml

示例GetCapabilities响应:POX

下面给出了一个兼容WMTS服务对面向过程的GetCapabilities KVP请求操作的POX响应示例。

下图提供了主要内容块的摘要级别描述:

../../_images/GetCapabilities-POX.png

此响应声明服务对kvpetcapabilities操作的支持。实际上,WMTS服务可能包含更多的层、tileMatrix集和主题,而不仅仅是这里显示的几个。

此示例改编自 WMTS Schemas ,这是WMTS规范的一部分。在同一位置可以找到相应的XML模式。一些冗长的XML内容已被删除,取而代之的是简短的注释,以减少完整响应所占用的空间。

<?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>World example Web Map Tile Service</ows:Title>
    <ows:Abstract>Example service that constrains some world layers
      in the urn:ogc:def:wkss:OGC:1.0:GlobalCRS84Pixel Well-known
      scale set</ows:Abstract>
    <ows:Keywords>
      <ows:Keyword>World</ows:Keyword>
      <ows:Keyword>Global</ows:Keyword>
      <ows:Keyword>Digital Elevation Model</ows:Keyword>
      <ows:Keyword>Administrative Boundaries</ows:Keyword>
    </ows:Keywords>
    <ows:ServiceType>OGC WMTS</ows:ServiceType>
    <ows:ServiceTypeVersion>1.0.0</ows:ServiceTypeVersion>
    <ows:Fees>none</ows:Fees>
    <ows:AccessConstraints>none</ows:AccessConstraints>
  </ows:ServiceIdentification>
  <ows:ServiceProvider>
    <ows:ProviderName>UAB-CREAF-MiraMon</ows:ProviderName>
    <ows:ProviderSite xlink:href="http://www.creaf.uab.es/miramon"/>
    <ows:ServiceContact>
      <ows:IndividualName>Joan Maso Pau</ows:IndividualName>
      <ows:PositionName>Senior Software Engineer</ows:PositionName>
      <ows:ContactInfo>
        <ows:Phone>
          <ows:Voice>+34 93 581 1312</ows:Voice>
          <ows:Facsimile>+34 93 581 4151</ows:Facsimile>
        </ows:Phone>
        <ows:Address>
          <ows:DeliveryPoint>Fac Ciencies UAB</ows:DeliveryPoint>
          <ows:City>Bellaterra</ows:City>
          <ows:AdministrativeArea>Barcelona</ows:AdministrativeArea>
          <ows:PostalCode>08193</ows:PostalCode>
          <ows:Country>Spain</ows:Country>
          <ows:ElectronicMailAddress>joan.maso@uab.es</ows:ElectronicMailAddress>
        </ows:Address>
      </ows:ContactInfo>
    </ows:ServiceContact>
  </ows:ServiceProvider>
  <ows:OperationsMetadata>
    <ows:Operation name="GetCapabilities">
      <ows:DCP>
        <ows:HTTP>
          <ows:Get xlink:href="http://cite.deegree.org/1.0.0">
            <ows:Constraint name="GetEncoding">
              <ows:AllowedValues>
                <ows:Value>KVP</ows:Value>
              </ows:AllowedValues>
            </ows:Constraint>
          </ows:Post>
        </ows:HTTP>
      </ows:DCP>
    </ows:Operation>
    <ows:Operation name="GetTile">
      <ows:DCP>
        <ows:HTTP>
          <ows:Post xlink:href="http://cite.deegree.org/1.0.0">
            <ows:Constraint name="GetEncoding">
              <ows:AllowedValues>
                <ows:Value>KVP</ows:Value>
              </ows:AllowedValues>
            </ows:Constraint>
          </ows:Post>
        </ows:HTTP>
      </ows:DCP>
    </ows:Operation>
  </ows:OperationsMetadata>
  <Contents>
    <Layer>
      <ows:Title>etopo2</ows:Title>
      <ows:Abstract>ETOPO2 - 2 minute Worldwide Bathymetry/Topography
        Data taken from National Geophysical Data Center(NGDC) CD-ROM, ETOPO2 Global 2' Elevations, September 2001.
        <!-- ***************************************************** -->
        <!-- [... insert additional Abstract information here ...] -->
        <!-- ***************************************************** -->
      </ows:Abstract>
      <ows:WGS84BoundingBox>
        <ows:LowerCorner>-180 -90</ows:LowerCorner>
        <ows:UpperCorner>180 90</ows:UpperCorner>
      </ows:WGS84BoundingBox>
      <ows:Identifier>etopo2</ows:Identifier>
      <ows:Metadata xlink:href="http://www.opengis.uab.es/SITiled/world/etopo2/metadata.htm"/>
      <Style isDefault="true">
        <ows:Title>default</ows:Title>
        <ows:Identifier>default</ows:Identifier>
        <LegendURL format="image/png" xlink:href="http://www.opengis.uab.es/SITiled/world/etopo2/legend.png"/>
      </Style>
      <Format>image/png</Format>
      <InfoFormat>application/gml+xml; version=3.1</InfoFormat>
      <TileMatrixSetLink>
        <TileMatrixSet>WholeWorld_CRS_84</TileMatrixSet>
      </TileMatrixSetLink>
      <ResourceURL format="image/png" resourceType="tile" template="http://www.opengis.uab.es/SITiled/world/etopo2/default/WholeWorld_CRS_84/{TileMatrix}/{TileRow}/{TileCol}.png"/>
      <ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo" template="http://www.opengis.uab.es/SITiled/world/etopo2/default/WholeWorld_CRS_84/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml"/>
    </Layer>
    <Layer>
      <ows:Title>Administrative Boundaries</ows:Title>
      <ows:Abstract>The sub Country Administrative Units 1998
        GeoDataset represents a small-scale world political map.
        <!-- ***************************************************** -->
        <!-- [... insert additional Abstract information here ...] -->
        <!-- ***************************************************** -->
      </ows:Abstract>
      <ows:WGS84BoundingBox>
        <ows:LowerCorner>-180 -90</ows:LowerCorner>
        <ows:UpperCorner>180 84</ows:UpperCorner>
      </ows:WGS84BoundingBox>
      <ows:Identifier>AdminBoundaries</ows:Identifier>
      <ows:Metadata xlink:href="http://www.opengis.uab.es/SITiled/world/AdminBoundaries/metadata.htm"/>
      <Style isDefault="true">
        <ows:Title>default</ows:Title>
        <ows:Identifier>default</ows:Identifier>
      </Style>
      <Format>image/png</Format>
      <TileMatrixSetLink>
        <TileMatrixSet>World84-90_CRS_84</TileMatrixSet>
      </TileMatrixSetLink>
      <ResourceURL format="image/png" resourceType="tile" template="http://cite.deegree.org/1.0.0/cite/default/2007-06/InspireCrs84Quad/{TileMatrix}/{TileRow}/{TileCol}.png"/>
      <ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo" template="http://cite.deegree.org/1.0.0/cite/default/2007-06/InspireCrs84Quad/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml"/>
    </Layer>
    <TileMatrixSet>
      <!-- optional bounding box of data in this CRS -->
      <ows:Identifier>WholeWorld_CRS_84</ows:Identifier>
      <ows:SupportedCRS>urn:ogc:def:crs:OGC:1.3:CRS84</ows:SupportedCRS>
      <WellKnownScaleSet>urn:ogc:def:wkss:OGC:1.0:GlobalCRS84Pixel</WellKnownScaleSet>
      <TileMatrix>
        <ows:Identifier>2g</ows:Identifier>
        <ScaleDenominator>795139219.951954</ScaleDenominator>
        <!-- top left point of tile matrix bounding box -->
        <TopLeftCorner>-180 90</TopLeftCorner>
        <!-- width and height of each tile in pixel units -->
        <TileWidth>320</TileWidth>
        <TileHeight>200</TileHeight>
        <!-- width and height of matrix in tile units -->
        <MatrixWidth>1</MatrixWidth>
        <MatrixHeight>1</MatrixHeight>
      </TileMatrix>
      <TileMatrix>
        <ows:Identifier>1g</ows:Identifier>
        <ScaleDenominator>397569609.975977</ScaleDenominator>
        <TopLeftCorner>-180 90</TopLeftCorner>
        <TileWidth>320</TileWidth>
        <TileHeight>200</TileHeight>
        <MatrixWidth>2</MatrixWidth>
        <MatrixHeight>1</MatrixHeight>
      </TileMatrix>
      <!-- *************************************************** -->
      <!-- [... insert additional TileMatrix entries here ...] -->
      <!-- *************************************************** -->
    </TileMatrixSet>
  </Contents>
  <Themes>
    <Theme>
      <ows:Title>Foundation</ows:Title>
      <ows:Abstract>World reference data</ows:Abstract>
      <ows:Identifier>Foundation</ows:Identifier>
      <Theme>
        <ows:Title>Digital Elevation Model</ows:Title>
        <ows:Identifier>DEM</ows:Identifier>
        <LayerRef>etopo2</LayerRef>
      </Theme>
      <Theme>
        <ows:Title>Administrative Boundaries</ows:Title>
        <ows:Identifier>AdmBoundaries</ows:Identifier>
        <LayerRef>AdminBoundaries</LayerRef>
      </Theme>
    </Theme>
    <Theme>
      <ows:Title>World Geology</ows:Title>
      <ows:Identifier>World Geology</ows:Identifier>
      <LayerRef>worldAgeRockType</LayerRef>
      <LayerRef>worldFaultLines</LayerRef>
      <LayerRef>felsicMagmatic</LayerRef>
      <LayerRef>maficMagmatic</LayerRef>
    </Theme>
  </Themes>
  <ServiceMetadataURL xlink:href="http://cite.deegree.org/1.0.0/WMTSCapabilities.xml"/>
</Capabilities>

示例GetCapabilities响应:SOAP

下面给出了一个响应面向过程的SOAP编码的GetCapabilities请求的ServiceMetadata文档的XML内容的简短表示。与痘反应相比,主要区别在于 [1] 肥皂和信封的存在 [2] 在OperationsMetadata部分中声明对SOAP接口的支持。

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <Capabilities version="1.0.0" ... >
      <ows:ServiceIdentification>
        <!-- **************************************************** -->
        <!-- [... insert ServiceIdentification elements here ...] -->
        <!-- **************************************************** -->
      </ows:ServiceIdentification>
      <ows:ServiceProvider>
        <!-- ********************************************** -->
        <!-- [... insert ServiceProvider elements here ...] -->
        <!-- ********************************************** -->
      </ows:ServiceProvider>
      <ows:OperationsMetadata>
        <ows:Operation name="GetCapabilities">
          <ows:DCP>
            <ows:HTTP>
              <ows:Post xlink:href="http://www.opengis.uab.es/cgi-bin/world/MiraMon5_0.cgi?">
                <ows:Constraint name="PostEncoding">
                  <ows:AllowedValues>
                    <ows:Value>SOAP</ows:Value>
                  </ows:AllowedValues>
                </ows:Constraint>
              </ows:Post>
            </ows:HTTP>
          </ows:DCP>
        </ows:Operation>
        <ows:Operation name="GetTile">
          <ows:DCP>
            <ows:HTTP>
              <ows:Post xlink:href="http://www.opengis.uab.es/cgi-bin/world/MiraMon5_0.cgi?">
                <ows:Constraint name="PostEncoding">
                  <ows:AllowedValues>
                    <ows:Value>SOAP</ows:Value>
                  </ows:AllowedValues>
                </ows:Constraint>
              </ows:Post>
            </ows:HTTP>
          </ows:DCP>
        </ows:Operation>
      </ows:OperationsMetadata>
      <Contents>
        <!-- *************************************** -->
        <!-- [... insert Contents elements here ...] -->
        <!-- *************************************** -->
      </Contents>
      <Themes>
        <!-- ************************************* -->
        <!-- [... insert Themes elements here ...] -->
        <!-- ************************************* -->
      </Themes>
    </Capabilities>
  </soap:Body>
</soap:Envelope>

面向资源样式下的示例服务元数据检索

在面向资源的样式下,ServiceMetadata文档响应的内容实际上与为POX响应呈现的内容完全相同,但HTTP编码可能不会在OperationsMetadata部分中描述(WMTS规范第7.1.1.1.1条)。相反,Layer元素中的“ResourceURL”和Capabilities元素中的“ServiceMetadataURL”用于标识资源端点。为了方便起见,POX响应中的这两个元素位置已复制到下面的代码块中。

<?xml version="1.0" encoding="UTF-8"?>
  <Capabilities ... version="1.0.0">
    <!-- ******************************************* -->
    <!-- [... insert Capabilities elements here ...] -->
    <!-- ******************************************* -->
    <Contents>
      <Layer>
        <!-- ************************************ -->
        <!-- [... insert Layer elements here ...] -->
        <!-- ************************************ -->
        <ResourceURL format="image/png" resourceType="tile" template="http://cite.deegree.org/1.0.0/cite/default/2007-06/InspireCrs84Quad/{TileMatrix}/{TileRow}/{TileCol}.png"/>
        <ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo" template="http://cite.deegree.org/1.0.0/cite/default/2007-06/InspireCrs84Quad/{TileMatrix}/{TileRow}/{TileCol}/{J}/{I}.xml"/>
      </Layer>
      <TileMatrixSet>
        <!-- ******************************************** -->
        <!-- [... insert TileMatrixSet elements here ...] -->
        <!-- ******************************************** -->
      </TileMatrixSet>
    </Contents>
    <Themes>
      <!-- ************************************* -->
      <!-- [... insert Themes elements here ...] -->
      <!-- ************************************* -->
    </Themes>
    <ServiceMetadataURL xlink:href="http://cite.deegree.org/1.0.0/WMTSCapabilities.xml"/>
  </Capabilities>

检索JSON服务元数据的示例客户端JavaScript实现

WMTS规范对 JavaScript Object Notation (JSON) . 因此,在源代码中包含JSON编码(例如JavaScript)来调用请求(或接收响应)不会影响实现是否符合WMTS标准。但是,OGC Testbed 12 initiative 在两个文件中提供了指导性的指导,一个工程报告和一个用户指南。这个 JavaScript JSON JSON- LD Engineering Report 提供了适合在WMTS案例中使用的JSON示例。同样地 JSON and GeoJSON User Guide 包括基于WMS的JavaScript示例,这些示例也经过了调整,以适用于WMTS。

面向过程的样式要求存在一个WMTS服务,该服务实现了“acceptFormats”参数,如 06-121r9 OGC Web Services Common Implementation Specification . 使用此服务,包含WMTS GetCapabilities操作的kvpet请求可以从以下JavaScript“loadJSON”调用开始。

loadJSON("https://cite.deegree.org/deegree-webservices-3.5.0/services/wmts100?request=GetCapabilities&service=WMTS&acceptsFormats=application/json",
  ShowCapabilities,
  function(xhr) { alert(xhr); }
)

类似的代码片段可以在面向资源的风格下开发,只需简单地替换URL“http://cite.deegree.org/1.0.0/WMTSCapabilities.json“作为第一个参数。不需要“acceptFormats”KVP。

第一个参数标识服务端点的URL,包括可接受的JSON响应类型。第二个参数指示在成功完成httpget请求时应该回调“ShowCapabilities”函数。第三个参数标识HTTP失败路径的回调。

loadJSON函数的代表性JavaScript代码如下所示。这段代码适用于任何一种架构风格。

function loadJSON(path, success, error)
{
  var xhr = new XMLHttpRequest();
  xhr.onreadystatechange = function()
    {
      if (xhr.readyState === XMLHttpRequest.DONE) {
        if (xhr.status === 200) {
          if (success)
            {
              var data;
              try {
                data = JSON.parse(xhr.responseText);
              } catch (e) {
                if (error)
                  return error("JSON file: \""+ path + "\". " + e);
              }
              success(data);
            }
        } else {
          if (error)
            error("JSON file: \""+ path + "\". " + xhr.statusText);
        }
    }
  };
  xhr.open("GET", path, true);
  xhr.send();
}

调用此函数将在HTTP成功执行路径下,通过调用JSON.parse()”功能。这个函数和XMLHttpRequest对象一起构建在大多数现代浏览器的基本JavaScript库(即,标准本地客户机API的一部分)中。

ShowCapabilities函数的代表性JavaScript代码如下所示。

function ShowCapabilities(capabilities)
{
    if (capabilities.serviceIdentification.serviceTypeVersion!=“1.0.0” ||
        capabilities.serviceIdentification.serviceType.code!="WMTS")
        alert("This is not a compatible WMTS JSON server");
    alert("The provider name is: " +
        capabilities.serviceProvider.providerName);
}

由于要执行的loadJSON()代码JSON.parse()在xhr.响应文本,则“capabilities”JavaScript变量将包含响应值,其子键名称与相应XML响应中的元素名称匹配。

如果WMTS服务提供类似以下JSON字符串的内容(在本例中报告两个HTTP异常),则可以为loadJSON()错误情况提供更友好的用户输出。

{
  "type": "ExceptionReport",
  "version": "1.0.0",
  "lang": "en",
  "exception": [{
    "type": "Exception",
    "exceptionCode": "MissingParameterValue",
    "exceptionText": "Service parameter missing",
    "locator": "service"
    },{
    "type": "Exception",
    "exceptionCode": "InvalidParameterValue",
    "exceptionText": "Version number not supported",
    "locator": "version”
  }]
}

图块资源的请求和响应示例

在面向过程的样式下,WMTS客户机可以以下列方式发出kvpgettile请求。

https://cite.deegree.org/deegree-webservices-3.5.0/services/wmts100?
service=WMTS&
request=GetTile&
version=1.0.0&
Layer=cite&
Style=default&
Format=image/png&
TileMatrixSet=InspireCrs84Quad&
TileMatrix=17&
TileRow=4&
TileCol=4

使用SOAP的同一请求将具有以下形式:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <GetTile xmlns="http://www.opengis.net/wmts/1.0"
      xmlns:ows="http://www.opengis.net/ows/1.1"
      xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetTile_request.xsd"
      service="WMTS" version="1.0.0">
      <Layer>cite</Layer>
      <Style>default</Style>
      <Format>image/png</Format>
      <DimensionNameValue name="TIME">2007-06</DimensionNameValue>
      <TileMatrixSet>InspireCrs84Quad</TileMatrixSet>
      <TileMatrix>17</TileMatrix>
      <TileRow>4</TileRow>
      <TileCol>4</TileCol>
    </GetTile>
  </soap:Body>
</soap:Envelope>

为了响应GetTile KVP请求,或者在面向资源的样式下,将返回符合所请求参数的Tile资源。正确制定的请求将生成如下所示的图像。

../../_images/wmts100.png

这是一个 link to the corresponding GetTile request

这是一个 link to a tile from the neighboring column

../../_images/wmts100b.png

可以在 `OGC WMTS简单配置文件<http://docs.opengeospatial.org/is/13-082r2/13-082r2.html>`_

../../_images/14664_OSM_GetTile_Response.png

链接到相应的图块资源<http://a.tile.openstreetmap.org/15/9798/14664.png> _。

下面给出了一个兼容WMTS服务对面向过程的SOAP编码的GetTiles请求的响应示例。此示例改编自 WMTS Schemas ,这是WMTS规范的一部分。

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <BinaryPayload xmlns="http://www.opengis.net/wmts/1.0"
      xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsPayload_response.xsd">
      <Format>image/png</Format>
      <BinaryContent>
        <![CDATA[iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
        C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
        AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
        REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
        ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
        vr4MkhoXe0rZigAAAABJRU5ErkJggg==]]>
      </BinaryContent>
    </BinaryPayload>
  </soap:Body>
</soap:Envelope>

功能信息资源的请求和响应示例

WMTS客户机可以以下列方式发出GetFeatureInfo KVP请求。

https://cite.deegree.org/deegree-webservices-3.5.0/services/wmts100?
service=WMTS&
request=GetFeatureInfo&
version=1.0.0&
Layer=cite&
Style=default&
Format=image/png&
TileMatrixSet=InspireCrs84Quad&
TileMatrix=17&
TileRow=4&
TileCol=4&
J=23&
I=35&
InfoFormat=text/html

使用SOAP的同一请求将具有以下形式。请注意,以下标记内容与上述GetTile请求下的内容相同:<Layer>、<Style>、<Format>、<DimensionNameValue name=“TIME”>、<TileMatrix>、<TileMatrix>、<TileRow>和<TileCol>。

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <GetFeatureInfo  xmlns="http://www.opengis.net/wmts/1.0"
      xmlns:ows="http://www.opengis.net/ows/1.1"
      xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetFeatureInfo_request.xsd"
      service="WMTS" version="1.0.0">
      <GetTile service="WMTS" version="1.0.0">
        <Layer>cite</Layer>
        <Style>default</Style>
        <Format>image/png</Format>
        <DimensionNameValue name="TIME">2007-06</DimensionNameValue>
        <TileMatrixSet>InspireCrs84Quad</TileMatrixSet>
        <TileMatrix>17</TileMatrix>
        <TileRow>4</TileRow>
        <TileCol>4</TileCol>
      </GetTile>
      <J>23</J>
      <I>35</I>
      <InfoFormat>text/html</InfoFormat>
    </GetFeatureInfo>
  </soap:Body>
</soap:Envelope>

响应GetFeatureInfo KVP请求,或者在面向资源的样式下,将返回符合所请求参数的POX特性信息文档。此示例改编自 WMTS Schemas ,这是WMTS规范的一部分。在同一位置可以找到相应的XML模式。

<?xml version="1.0" encoding="UTF-8"?>
<ReguralGridedElevations xmlns="http://www.opengis.uab.es/SITiled/world/etopo2" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.uab.es/SITiled/world/etopo2 wmtsGetFeatureInfo_response_GML.xsd">
  <gml:featureMember>
    <GridPoint_etopo2>
      <elevation>503.0</elevation>
      <TileRow>4</TileRow>
      <TileCol>4</TileCol>
      <J>23</J>
      <I>35</I>
      <Geometry>
        <gml:Point srsDimension="2" srsName="urn:ogc:def:crs:OGC:1.3:CRS84">
          <gml:pos>2.50 42.22</gml:pos>
        </gml:Point>
      </Geometry>
    </GridPoint_etopo2>
  </gml:featureMember>
</ReguralGridedElevations>

下面给出了一个兼容WMTS服务对面向过程的SOAP编码的GetFeatureInfo请求的响应示例。此示例改编自 WMTS Schemas ,这是WMTS规范的一部分。

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xsi:schemaLocation="http://www.w3.org/2003/05/soap-envelope http://www.w3.org/2003/05/soap-envelope">
  <soap:Body>
    <FeatureInfoResponse xmlns="http://www.opengis.net/wmts/1.0"
      xmlns:gml="http://www.opengis.net/gml"
      xsi:schemaLocation="http://www.opengis.net/wmts/1.0 http://schemas.opengis.net/wmts/1.0/wmtsGetFeatureInfo_response.xsd">
      <ReguralGridedElevations xmlns="http://www.opengis.uab.es/SITiled/world/etopo2"
        xmlns:gml="http://www.opengis.net/gml"
        xsi:schemaLocation="http://www.opengis.uab.es/SITiled/world/etopo2 wmtsGetFeatureInfo_response_GML.xsd">
        <gml:featureMember>
          <GridPoint_etopo2>
            <elevation>503.0</elevation>
            <TileRow>4</TileRow>
            <TileCol>4</TileCol>
            <J>23</J>
            <I>35</I>
          </GridPoint_etopo2>
        </gml:featureMember>
      </ReguralGridedElevations>
    </FeatureInfoResponse>
  </soap:Body>
</soap:Envelope>

工具书类

Creative Commons 3.0