399 lines
17 KiB
Markdown
399 lines
17 KiB
Markdown
|
---
|
|||
|
title: WCS简述
|
|||
|
date: 2020-03-29
|
|||
|
author: ac
|
|||
|
tags:
|
|||
|
- WCS
|
|||
|
categories:
|
|||
|
- GIS
|
|||
|
---
|
|||
|
|
|||
|
## 1. Coverages
|
|||
|
|
|||
|
在介绍`Web Coverage Service`之前,我们先了解一下`Coverages`。
|
|||
|
|
|||
|
`Coverages`表示位于空间/时间上的同构值集合,例如时空传感器、图像、模拟和统计数据。比如一维的时间序列、二维图像、三维(x,y,t)图像时间序列和(x,y,z)地球物理体元模型,以及4D的(x,y,z,t)气候和海洋数据。
|
|||
|
|
|||
|
`Coverages`可以以任何合适的格式编码(如`GML`、`JSON`、`GeoTIFF`或`Net-CDF`),并且可以进行分区。它可以由单个文档(流或文件)或一组分层组织的文档表示,每个文档都可以单独编码,例如,`domain set`、`range type`和`metadata` 可以编码成易于解析的`GML`、`JSON`、或`RDF`,而`range set`是用一些紧凑的二进制格式编码的,如`NetCDF`或`JPEG2000`。这样的分区允许在空间、时间或混合中平铺覆盖,从而支持镶嵌、时间交错覆盖和有效的可子集数据集。
|
|||
|
|
|||
|
> `OGC`的Coverage Implementation Schema(`CIS`)通过建立一个具体的、可互操作的、符合性可测试的覆盖结构来指定`OGC coverage model`
|
|||
|
|
|||
|
下图是`AbstractCoverage`接口的类图:
|
|||
|
|
|||
|
<img src="./images/abstractCoverageStructure.png" alt="abstractCoverageStructure" style="zoom: 33%;" />
|
|||
|
|
|||
|
- `coverageFunction`:描述如何获得`Coverage`位置的范围值
|
|||
|
- `envelope`:`Coverage` 的 bounding box
|
|||
|
|
|||
|
- `DomainSet`:coverage 切确的位置,描述边界(envelope)。通过一个轴的有序列表来定义,这些轴的上界和下界建立了每个轴的范围
|
|||
|
- `rangeSet`:coverage 实际范围值,每一个都与`domain set`中定义的一个直接位置相关联。
|
|||
|
- `rangeType`:coverage 结构的描述和技术元数据,是一个`SWE Common`规范中的`DataRecord`,另外还可以添加一个插补指令。
|
|||
|
- `metadata`:特定的元数据,允许单独的扩展
|
|||
|
|
|||
|
|
|||
|
|
|||
|
`Coverages`独立于服务定义,因此可以通过各种`OGC`服务类型进行访问,例如`WCS`。
|
|||
|
|
|||
|
## 2. WCS(Web Coverage Service)
|
|||
|
|
|||
|
`OGC` 网络覆盖服务 (`WCS`) 支持将地理空间数据作为`Coverage`进行电子检索,为如何请求地理空间图像的栅格源提供了一个标准接口。
|
|||
|
|
|||
|

|
|||
|
|
|||
|
|
|||
|
|
|||
|
## 3. WCS的核心操作
|
|||
|
|
|||
|
`WCS`可以执行以下操作:
|
|||
|
|
|||
|
| **Operation** | **Description** |
|
|||
|
| ------------------ | ----------------------------------------------- |
|
|||
|
| `GetCapabilities` | 检索服务器数据的列表,以及有效的`WCS`操作和参数 |
|
|||
|
| `DescribeCoverage` | 检索完整描述请求覆盖范围的XML文档。 |
|
|||
|
| `GetCoverage` | 返回特定格式的Coverage |
|
|||
|
|
|||
|
### 3.1 GetCapabilities
|
|||
|
|
|||
|
参数列表:
|
|||
|
|
|||
|
| name | description |
|
|||
|
| ----------------------- | --------------------- |
|
|||
|
| service=wcs | 服务名称,固定为"wcs" |
|
|||
|
| version | 版本 |
|
|||
|
| request=GetCapabilities | 操作 |
|
|||
|
|
|||
|
KVP形式:
|
|||
|
|
|||
|
`http://localhost:8080/geoserver/ows?service=wcs&version=1.0.0&request=GetCapabilities`
|
|||
|
|
|||
|
XML形式:
|
|||
|
|
|||
|
`http://localhost:8080/geoserver/wcs`
|
|||
|
|
|||
|
```xml
|
|||
|
<GetCapabilities
|
|||
|
service="WCS"
|
|||
|
version="1.0.0"
|
|||
|
xmlns="http://www.opengis.net/wcs"
|
|||
|
xmlns:nurc="http://www.nurc.nato.int"
|
|||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|||
|
xsi:schemaLocation="http://www.opengis.net/wcs http://schemas.opengis.net/wcs/1.0.0/wcsCapabilities.xsd"/>
|
|||
|
```
|
|||
|
|
|||
|
响应示例:
|
|||
|
|
|||
|
响应结果包含服务`description`服务描述、`Capability`服务能力、`ContentMetadata`服务器中提供的栅格数据信息(栅格图层)。
|
|||
|
|
|||
|
```xml
|
|||
|
<?xml version="1.0" encoding="UTF-8"?>
|
|||
|
<wcs:WCS_Capabilities version="1.0.0" xmlns:wcs="http://www.opengis.net/wcs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wcs http://localhost:8080/geoserver/schemas/wcs/1.0.0/wcsCapabilities.xsd" updateSequence="367">
|
|||
|
<wcs:Service>
|
|||
|
<wcs:metadataLink about="http://geoserver.sourceforge.net/html/index.php" xlink:type="simple" metadataType="other"/>
|
|||
|
<wcs:description>This server implements the WCS specification 1.0 and 1.1.1, it's reference implementation of WCS 1.1.1. All layers published by this service are available on WMS also.
|
|||
|
</wcs:description>
|
|||
|
<wcs:name>WCS</wcs:name>
|
|||
|
<wcs:label>Web Coverage Service</wcs:label>
|
|||
|
<wcs:keywords>
|
|||
|
<wcs:keyword>WCS</wcs:keyword>
|
|||
|
<wcs:keyword>WMS</wcs:keyword>
|
|||
|
<wcs:keyword>GEOSERVER</wcs:keyword>
|
|||
|
</wcs:keywords>
|
|||
|
<wcs:responsibleParty>
|
|||
|
...
|
|||
|
</wcs:responsibleParty>
|
|||
|
<wcs:fees>NONE</wcs:fees>
|
|||
|
<wcs:accessConstraints>NONE</wcs:accessConstraints>
|
|||
|
</wcs:Service>
|
|||
|
<wcs:Capability>
|
|||
|
<wcs:Request>
|
|||
|
<wcs:GetCapabilities>
|
|||
|
...
|
|||
|
</wcs:GetCapabilities>
|
|||
|
<wcs:DescribeCoverage>
|
|||
|
...
|
|||
|
</wcs:DescribeCoverage>
|
|||
|
<wcs:GetCoverage>
|
|||
|
...
|
|||
|
</wcs:GetCoverage>
|
|||
|
</wcs:Request>
|
|||
|
<wcs:Exception>
|
|||
|
<wcs:Format>application/vnd.ogc.se_xml</wcs:Format>
|
|||
|
</wcs:Exception>
|
|||
|
</wcs:Capability>
|
|||
|
<wcs:ContentMetadata>
|
|||
|
<wcs:CoverageOfferingBrief>
|
|||
|
<wcs:description>Generated from arcGridSample</wcs:description>
|
|||
|
<wcs:name>nurc:Arc_Sample</wcs:name>
|
|||
|
<wcs:label>A sample ArcGrid file</wcs:label>
|
|||
|
<wcs:lonLatEnvelope srsName="urn:ogc:def:crs:OGC:1.3:CRS84">
|
|||
|
<gml:pos>-180.0 -90.0</gml:pos>
|
|||
|
<gml:pos>180.0 90.0</gml:pos>
|
|||
|
</wcs:lonLatEnvelope>
|
|||
|
<wcs:keywords>
|
|||
|
<wcs:keyword>WCS</wcs:keyword>
|
|||
|
<wcs:keyword>arcGridSample</wcs:keyword>
|
|||
|
<wcs:keyword>arcGridSample_Coverage</wcs:keyword>
|
|||
|
</wcs:keywords>
|
|||
|
</wcs:CoverageOfferingBrief>
|
|||
|
...
|
|||
|
</wcs:ContentMetadata>
|
|||
|
</wcs:WCS_Capabilities>
|
|||
|
```
|
|||
|
|
|||
|
|
|||
|
|
|||
|
### 3.2 DescribeCoverage
|
|||
|
|
|||
|
获取地图服务器中某个`coverage`描述。
|
|||
|
|
|||
|
参数列表:
|
|||
|
|
|||
|
| name | description | data type | m/o |
|
|||
|
| ---------- | -------------- | ------------------------------ | ---- |
|
|||
|
| service | 服务类型 | String,固定为"WCS" | m |
|
|||
|
| version | 版本 | String | m |
|
|||
|
| extension | 辅助信息 | Extension | o |
|
|||
|
| coverageId | coverage的标识 | NCName,(工作空间+图层名) | m |
|
|||
|
| request | 操作类型 | String,固定为DescribeCoverage | m |
|
|||
|
|
|||
|
> 服务类型要大写"WCS"
|
|||
|
|
|||
|
KVP形式:
|
|||
|
|
|||
|
`http://localhost:8080/geoserver/ows?service=WCS&request=describecoverage&coverageid=Pk50095&version=1.0.0`
|
|||
|
|
|||
|
`http://localhost:8080/geoserver/ows?service=WCS&request=describecoverage&identifiers=Pk50095&version=1.1.0`
|
|||
|
|
|||
|
XML形式:
|
|||
|
|
|||
|
`http://localhost:8080/geoserver/wcs`
|
|||
|
|
|||
|
```xml
|
|||
|
<DescribeCoverage
|
|||
|
version="1.0.0"
|
|||
|
service="WCS"
|
|||
|
xmlns="http://www.opengis.net/wcs"
|
|||
|
xmlns:nurc="http://www.nurc.nato.int"
|
|||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|||
|
xsi:schemaLocation="http://www.opengis.net/wcs http://schemas.opengis.net/wcs/1.0.0/describeCoverage.xsd">
|
|||
|
<Coverage>nurc:Pk50095</Coverage>
|
|||
|
</DescribeCoverage>
|
|||
|
```
|
|||
|
|
|||
|
响应结果示例:
|
|||
|
|
|||
|
```xml
|
|||
|
<?xml version="1.0" encoding="UTF-8"?>
|
|||
|
<wcs:CoverageDescription xmlns:wcs="http://www.opengis.net/wcs" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ogc="http://www.opengis.net/ogc" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wcs http://localhost:8080/geoserver/schemas/wcs/1.0.0/describeCoverage.xsd" version="1.0.0">
|
|||
|
<wcs:CoverageOffering>
|
|||
|
<wcs:description>Generated from img_sample2</wcs:description>
|
|||
|
<wcs:name>nurc:Pk50095</wcs:name>
|
|||
|
<wcs:label>Pk50095</wcs:label>
|
|||
|
<wcs:lonLatEnvelope srsName="urn:ogc:def:crs:OGC:1.3:CRS84">
|
|||
|
<gml:pos>12.999446822650462 46.722110379286</gml:pos>
|
|||
|
<gml:pos>13.308182612644663 46.91359611878293</gml:pos>
|
|||
|
</wcs:lonLatEnvelope>
|
|||
|
<wcs:keywords>
|
|||
|
<wcs:keyword>WCS</wcs:keyword>
|
|||
|
<wcs:keyword>img_sample2</wcs:keyword>
|
|||
|
<wcs:keyword>Pk50095</wcs:keyword>
|
|||
|
</wcs:keywords>
|
|||
|
<wcs:domainSet>
|
|||
|
<wcs:spatialDomain>
|
|||
|
<gml:Envelope srsName="EPSG:32633">
|
|||
|
<gml:pos>347649.93086859107 5176214.082539256</gml:pos>
|
|||
|
<gml:pos>370725.976428591 5196961.352859256</gml:pos>
|
|||
|
</gml:Envelope>
|
|||
|
<gml:RectifiedGrid dimension="2" srsName="EPSG:32633">
|
|||
|
<gml:limits>
|
|||
|
<gml:GridEnvelope>
|
|||
|
<gml:low>0 0</gml:low>
|
|||
|
<gml:high>544 489</gml:high>
|
|||
|
</gml:GridEnvelope>
|
|||
|
</gml:limits>
|
|||
|
<gml:axisName>E</gml:axisName>
|
|||
|
<gml:axisName>N</gml:axisName>
|
|||
|
<gml:origin>
|
|||
|
<gml:pos>347671.1015525911 5196940.182175256</gml:pos>
|
|||
|
</gml:origin>
|
|||
|
<gml:offsetVector>42.34136799999989 0.0</gml:offsetVector>
|
|||
|
<gml:offsetVector>0.0 -42.34136800000026</gml:offsetVector>
|
|||
|
</gml:RectifiedGrid>
|
|||
|
</wcs:spatialDomain>
|
|||
|
</wcs:domainSet>
|
|||
|
<wcs:rangeSet>
|
|||
|
<wcs:RangeSet>
|
|||
|
<wcs:name>Pk50095</wcs:name>
|
|||
|
<wcs:label>Pk50095</wcs:label>
|
|||
|
<wcs:axisDescription>
|
|||
|
<wcs:AxisDescription>
|
|||
|
<wcs:name>Band</wcs:name>
|
|||
|
<wcs:label>Band</wcs:label>
|
|||
|
<wcs:values>
|
|||
|
<wcs:interval>
|
|||
|
<wcs:min>1</wcs:min>
|
|||
|
<wcs:max>3</wcs:max>
|
|||
|
</wcs:interval>
|
|||
|
</wcs:values>
|
|||
|
</wcs:AxisDescription>
|
|||
|
</wcs:axisDescription>
|
|||
|
</wcs:RangeSet>
|
|||
|
</wcs:rangeSet>
|
|||
|
<wcs:supportedCRSs>
|
|||
|
<wcs:requestResponseCRSs>EPSG:32633</wcs:requestResponseCRSs>
|
|||
|
</wcs:supportedCRSs>
|
|||
|
<wcs:supportedFormats nativeFormat="WorldImage">
|
|||
|
<wcs:formats>ARCGRID</wcs:formats>
|
|||
|
<wcs:formats>GeoTIFF</wcs:formats>
|
|||
|
<wcs:formats>GIF</wcs:formats>
|
|||
|
<wcs:formats>IMAGEMOSAIC</wcs:formats>
|
|||
|
<wcs:formats>JPEG</wcs:formats>
|
|||
|
<wcs:formats>PNG</wcs:formats>
|
|||
|
<wcs:formats>TIFF</wcs:formats>
|
|||
|
</wcs:supportedFormats>
|
|||
|
<wcs:supportedInterpolations default="nearest neighbor">
|
|||
|
<wcs:interpolationMethod>nearest neighbor</wcs:interpolationMethod>
|
|||
|
<wcs:interpolationMethod>bilinear</wcs:interpolationMethod>
|
|||
|
<wcs:interpolationMethod>bicubic</wcs:interpolationMethod>
|
|||
|
<wcs:interpolationMethod>bicubic_2</wcs:interpolationMethod>
|
|||
|
</wcs:supportedInterpolations>
|
|||
|
</wcs:CoverageOffering>
|
|||
|
</wcs:CoverageDescription>
|
|||
|
```
|
|||
|
|
|||
|
> 这里的\<gml:axisName>标签为下面`getCoverage`请求中维度`dimension`参数的可选值。
|
|||
|
|
|||
|
### 3.3 GetCoverage
|
|||
|
|
|||
|
`GetCoverage`请求`WCS`服务处理特定coverage,并返回空间数据。它可以检索覆盖率的子集,结果可以是覆盖率本身或对它的引用。
|
|||
|
|
|||
|
`GetCoverage`请求最强大的功能是它子集域(高度和时间)和范围的能力。它还可以进行重采样,以不同的数据格式编码,并以不同的方式返回结果文件。
|
|||
|
|
|||
|
<img src="./images/image-20210702165344490.png" alt="image-20210702165344490" style="zoom: 50%;" />
|
|||
|
|
|||
|
请求参数列表:
|
|||
|
|
|||
|
| name | description | data type | m/o |
|
|||
|
| --------------- | ------------------------ | --------------------------------- | ---- |
|
|||
|
| service | 服务类型 | String,固定为"WCS" | m |
|
|||
|
| version | | String | m |
|
|||
|
| extension | | Any | o |
|
|||
|
| coverageId | coverage标识 | NCName | m |
|
|||
|
| format | 返回格式 | anyURI | o |
|
|||
|
| mediaType | 如果存在,强制多部分编码 | anyURI,固定为“multipart/related” | o |
|
|||
|
| dimensionSubset | | DimensionSubset | o |
|
|||
|
|
|||
|
> `dimensionSubset`:从服务器获取数据时修剪或切片维度
|
|||
|
|
|||
|
format参数应该是`describecoverage`操作返回结果中`<wcs:supportedFormats>`标签下的类型,默认是`coverage`原来的格式;
|
|||
|
|
|||
|
`dimensionSubset`由一组`coverage`的`dimension`设置的子集规则(`subseting specifications`)组成。
|
|||
|
|
|||
|
<div style='text-align:center'>DimensionSubset structure</div>
|
|||
|
|
|||
|
| name | definition | data type | Multiplicity |
|
|||
|
| --------- | --------------------------------------- | --------- | -------------- |
|
|||
|
| dimension | Name of dimension along which to subset | NCName | one(mandatory) |
|
|||
|
|
|||
|
> 一个`GetCoverage`请求中最多包含一个`subsetibt`操作,且每个`dimension`维度最多包含一个针对`coverage`的的`subsetting`操作。常见的`dimension`有:
|
|||
|
>
|
|||
|
> - 地理坐标的经纬度(dimension=Long,dimension=Lat)
|
|||
|
> - 投影坐标的XY轴(dimension=E,dimension=N)
|
|||
|
|
|||
|
根据`dimensionSubset`是裁剪还是分割操作,其对应了两个子类:
|
|||
|
|
|||
|
- `DimensionTrim`
|
|||
|
- `DimensionSlice`
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#### 3.3.1 `DimensionTrim`
|
|||
|
|
|||
|
`DimensionTrim`有`trimLow`和`trimHigh`两个属性,用来指定某个维度`dimension`下的裁剪区间,但不能超过`coverage`原始数据的` gml:Envelope`范围。比如`coverage`在x轴下的最大值为H,最小值为L,则有L<=`trimLow`<=`trimHigh`<=H。
|
|||
|
|
|||
|
示例:
|
|||
|
|
|||
|
```xml
|
|||
|
<?xml version="1.0" encoding="UTF-8"?>
|
|||
|
<wcs:GetCoverage service="WCS" version="2.0.1"
|
|||
|
xmlns:wcs="http://www.opengis.net/wcs/2.0"
|
|||
|
xmlns:crs="http://www.opengis.net/spec/WCS_service-extension_crs/1.0"
|
|||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|||
|
xsi:schemaLocation="http://www.opengis.net/wcs/2.0 http://schemas.opengis.net/wcs/2.0/wcsAll.xsd">
|
|||
|
<wcs:CoverageId>nurc__mosaic</wcs:CoverageId>
|
|||
|
<wcs:DimensionTrim>
|
|||
|
<wcs:Dimension>Long</wcs:Dimension>
|
|||
|
<wcs:TrimLow>8</wcs:TrimLow>
|
|||
|
<wcs:TrimHigh>10</wcs:TrimHigh>
|
|||
|
</wcs:DimensionTrim>
|
|||
|
<wcs:DimensionTrim>
|
|||
|
<wcs:Dimension>Lat</wcs:Dimension>
|
|||
|
<wcs:TrimLow>38.5</wcs:TrimLow>
|
|||
|
<wcs:TrimHigh>43.5</wcs:TrimHigh>
|
|||
|
</wcs:DimensionTrim>
|
|||
|
<wcs:Extension>
|
|||
|
<crs:subsettingCrs>
|
|||
|
http://www.opengis.net/def/crs/EPSG/0/4326
|
|||
|
</crs:subsettingCrs>
|
|||
|
</wcs:Extension>
|
|||
|
</wcs:GetCoverage>
|
|||
|
```
|
|||
|
|
|||
|
<div style="text-align:center">
|
|||
|
<img src="./images/image-20210705110436978.png"/>
|
|||
|
<img src="./images/image-20210705110546049.png" alt="image-20210705110546049" style="zoom:33%;" />
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#### 3.3.2 `DimensionSlice`
|
|||
|
|
|||
|
`Dimension`有一个`slicePoint`属性,用来指定某个`dimension`维度分割的位置点,但不能超过`coverage`中`gml:Envelope`的范围。
|
|||
|
|
|||
|
这里没有找到相关操作示例。
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#### 3.3.3 服务扩展
|
|||
|
|
|||
|
**Range Subsetting Extension**
|
|||
|
|
|||
|
该扩展定义了从WCS服务器提供的`coverage`中检索选定的`range`组件.
|
|||
|
|
|||
|
选择是基于`coverage`中定义的`range type`,其中由可识别的组件(\<swe:DataRecord>)给出。在某些域中,这些`range`组件定义的`range type`称为“通道”、“波段”或“变量”。
|
|||
|
|
|||
|
<img src="./images/image-20210706110821141.png" alt="image-20210706110821141" style="zoom: 67%;" />
|
|||
|
|
|||
|
> **RangeSubset**: Used to select a subset of coverage fields to the dataset.
|
|||
|
>
|
|||
|
> **Subset**: Trim or slice a dimension when fetching data from the server
|
|||
|
|
|||
|
示例:
|
|||
|
|
|||
|
以GeoServer自带的`nurc:mosaic`图层为示例数据,我们可以在`编辑图层`中看到`Coverage`波段详情:
|
|||
|
|
|||
|

|
|||
|
|
|||
|
1. 选择`RED_BAND`波段的子集,即导出的`coverage`为`RED_BAND`单一波段的tiff文件
|
|||
|
|
|||
|
`http://localhost:8080/geoserver/wcs?SERVICE=WCS&REQUEST=GetCoverage&VERSION=2.0.1&CoverageId=nurc__mosaic&RANGESUBSET=RED_BAND`
|
|||
|
|
|||
|
<div style="text-align:center">
|
|||
|
<img src="./images/image-20210706135913057.png" alt="image-20210705110546049" style="zoom:33%;" />
|
|||
|
</div>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
## 参考文章
|
|||
|
|
|||
|
[1] OGC Coverage Implementation Schema http://docs.opengeospatial.org/is/09-146r8/09-146r8.html
|
|||
|
|
|||
|
[2] Web Coverage Service https://www.ogc.org/standards/wcs
|
|||
|
|
|||
|
[3] WCS reference https://docs.geoserver.org/latest/en/user/services/wcs/reference.html
|
|||
|
|
|||
|
[4] OGC® Web Coverage Service Interface Standard -Range Subsetting Extension https://portal.ogc.org/files/12-040
|