WPS操作¶
WPS 1.0.0标准定义了三个用于发现和执行地理空间流程的操作,而Geoserver使用另外两个供应商或伪操作对这些操作进行了扩展。这些操作包括:
Operation |
Description |
检索服务产品的详细信息,包括服务元数据和描述可用流程的元数据 |
|
检索可通过该服务使用的WPS进程的说明 |
|
使用指定的输入值和必需的输出数据项执行流程的请求 |
|
Dismiss (供应商扩展名) |
用于取消进程的执行 |
GetExecutions (供应商扩展名) |
检索当前执行状态的列表 |
GetCapabilities¶
这个 GetCapabilities 操作请求服务提供的详细信息,包括服务元数据和描述可用进程的元数据。响应是一个名为 能力文档 .
与所有ogc getcapabilities请求一样,所需的参数是 service=WPS
, version=1.0.0
和 request=GetCapabilities
.
getCapabilities请求的一个示例是:
http://localhost:8080/geoserver/ows?
service=WPS&
version=1.0.0&
request=GetCapabilities
DescribeProcess¶
这个 DescribeProcess 操作请求对服务中可用的WPS进程的描述。
参数 identifier
指定要描述的进程。可以请求多个进程,用逗号分隔(例如, identifier=JTS:buffer,gs:Clip
)。必须至少指定一个进程。
备注
与所有OGC参数一样,键 (request
, version
等)不区分大小写,并且值 (GetCapabilities
, JTS:buffer
等)区分大小写。geoserver通常对case更为宽松,但最好遵循规范。
响应是一个XML文档,其中包含有关每个请求进程的元数据,包括以下内容:
流程名称、标题和摘要
对于每个输入和输出参数:标识符、标题、摘要、多重性和支持的数据类型和格式
流程的示例请求 JTS:buffer
是::
http://localhost:8080/geoserver/ows?
service=WPS&
version=1.0.0&
request=DescribeProcess&
identifier=JTS:buffer
响应XML文档包含以下信息:
Title |
“使用特定距离缓冲几何图形” |
Inputs |
geom :“要缓冲的几何图形” (几何图形,强制) 距离 :“距离(与几何体相同的测量单位)” (双精度,强制) 象限段 :“象限段数。圆连接使用>0,平连接使用0,斜接连接使用<0“ (整数,可选) 披风 :“缓冲帽样式,圆形、扁平、方形” (文字值,可选) |
输出格式 |
Geoserver支持的几何编码格式之一 |
通常,Geoserver进程使用复杂对象作为输入和对象,如几何图形、要素集合和栅格数据。
可用于这些复杂过程中的每一个的输入和输出的格式通常由过程参数IO类来管理,这些类是由WPS机器附加到每个过程的通用编码器/解码器。
在Geoserver WPS的核心中,可以使用以下PPIO:
对于几何图形,GML 2和3,GeoJSON,熟知文本。
对于要素集合、GML2和3、GeoJSON、压缩的Shapefile和KML。
对于栅格、GeoTIFF、PNG、JPEG。
可以通过安装插件来扩展PPIO集。例如, DXF extension 附带一个PPIO,可以将要素集合编码为DXF格式:插入后,大多数在输出中生成要素集合的进程也会将其编码为DXF格式。
执行¶
这个 执行 操作是使用指定的输入值和必需的输出数据项执行进程的请求。请求可以作为GET URL或带有XML请求文档的POST发出。因为请求具有复杂的结构,所以更常用的是post表单。
请求所需的输入和输出取决于正在执行的进程。geoserver提供了多种处理几何图形、特征和覆盖范围数据的过程。有关更多信息,请参阅部分 工艺食谱 .
下面是一个例子 Execute
发布请求。示例流程 (JTS:buffer
)将几何图形作为输入 geom
(在这种情况下,重点是 POINT(0 0)
a) distance
(带值 10
)量化因子 quadrantSegments
(这里设为1),以及 capStyle
(指定为 flat
)这个 <ResponseForm>
元素指定单个输出的格式 result
应为GML 3.1.1。
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>JTS:buffer</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>geom</ows:Identifier>
<wps:Data>
<wps:ComplexData mimeType="application/wkt"><![CDATA[POINT(0 0)]]></wps:ComplexData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>distance</ows:Identifier>
<wps:Data>
<wps:LiteralData>10</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>quadrantSegments</ows:Identifier>
<wps:Data>
<wps:LiteralData>1</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>capStyle</ows:Identifier>
<wps:Data>
<wps:LiteralData>flat</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="application/gml-3.1.1">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
进程使用提供的输入执行缓冲区操作,并返回指定的输出。请求的响应是(为了清晰起见,将数字四舍五入):
<?xml version="1.0" encoding="utf-8"?>
<gml:Polygon xmlns:sch="http://www.ascc.net/xml/schematron"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink">
<gml:exterior>
<gml:LinearRing>
<gml:posList>
10.0 0.0
0.0 -10.0
-10.0 0.0
0.0 10.0
10.0 0.0
</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
有关生成WPS请求的帮助,可以使用内置的Interactive WPS请求生成器 .
解除¶
备注
这是Geoserver WPS服务的供应商扩展。此操作特定于Geoserver。
根据WPS规范,异步进程执行返回到状态位置的回链接,客户机可以ping该状态位置以获取有关进程的进度报告,并最终检索其最终结果。
在geoserver中,此链接作为伪操作实现,称为 GetExecutionStatus
,链接具有以下结构:
http://host:port/geoserver/ows?service=WPS&version=1.0.0&request=GetExecutionStatus&executionId=397e8cbd-7d51-48c5-ad72-b0fcbe7cfbdb
这个 executionId
标识正在运行的请求,并可在 Dismiss
供应商操作,以取消流程的执行:
收到后,Geoserver将尽最大努力停止正在运行的进程,并随后调用 Dismiss
或 GetExecutionStatus
将报告执行ID不再是已知的。在内部,Geoserver将停止任何试图报告进度的进程,并毒化输入和输出以中断进程的执行,但已获得其输入且不报告其进度的进程的执行将继续,直到其自然结束。
例如,让我们考虑“geo:buffer”过程,可能是针对一个非常大的输入gml几何体,从另一个主机获取。进程本身对JTS函数执行单个调用,该函数不能报告进度。根据调用解除操作的时间,有三种可能的情况:
在检索GML时调用disclusion,在这种情况下,执行将立即停止
当进程正在进行缓冲时调用disclose,在这种情况下,一旦缓冲完成,执行将停止。
在编码输出gml时调用disclusion,在这种情况下,执行将立即停止。
GetExecutions¶
备注
这是Geoserver WPS服务的供应商扩展。此操作特定于Geoserver。
此操作允许客户端识别WPS执行列表。

客户机向WPS服务器发出一个简单的“getExecutions”请求,以便返回包含当前执行状态列表的XML文档。
还可以过滤“GetExecutions”请求和简单参数,以便优化输出并仅返回我们正在查找的执行状态。
再多加一点,授权头必须与“getexecutions”请求一起发送;如果安全子系统可用并在后者上启用,则WPS服务器将能够向客户机本身证明列表资源。
该操作将只返回登录用户已启动的可用执行列表,但管理员除外。那样的话,他就可以得到整个名单了。
如果已经指定了WPS执行请求的“沿袭”选项,客户端将能够检索提供给进程标识符的执行输入值。
状态信息文档¶
参考http://docs.opengeospatial.org/is/14-065/14-065.html第9.5节并对其进行扩展。
statusInfo文档用于提供有关WPS服务器上作业的标识和状态信息。该操作向statusInfo文档报告添加了其他字段,还添加了WPS进程标识符以及有关估计执行和过期时间的其他信息。

GetExecutionsOperation¶
GetExecutions操作允许WPS客户端检索在WPS实例上运行的可用进程作业列表。输出以XML文档的形式返回。
GetExecutions操作只返回登录用户已启动的可用执行列表,管理员除外。那样的话,他就可以得到整个名单了。

GetExecutionsRequest¶
GetExecutions请求是同步执行的公共结构。它从RequestBaseType继承基本属性,并包含允许筛选、优化和排序可用流程作业列表的其他元素。


GetExecutionsResponse¶
getExecutionResponse始终以XML文档的形式存在。除了例外情况,响应文档将包含根据指定参数过滤、优化或排序的statusInfo元素列表。
响应分页¶
响应分页是一个客户机在一组响应值之间滚动的能力,一次滚动n个值,就像一个客户机在搜索引擎的响应中滚动一个页面一样。
与WFS 2.0.0响应分页机制类似(请参阅规范的“7.7.4.4响应分页”一节),输出将向客户端显示以下属性作为响应文档的一部分。

GetExecutionsExceptions¶
当WPS服务器在执行getExecutionResponse时遇到错误时,它应返回第8条规定的异常报告。 [OGC 06-121r9] .如果适用,服务器应使用本节中定义的其他异常代码。

检索WPS执行输入值¶
GetExecutions操作尝试(尽最大努力)从执行请求中检索指定的输入值。 iff 这个 lineage
已为执行请求提供选项。
示例请求 lineage
激活选项
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>JTS:convexHull</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>geom</ows:Identifier>
<wps:Reference mimeType="application/wkt" xlink:href="http://www.geo-solutions.it/geoserver/wfs?" method="GET"/>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument lineage="true" storeExecuteResponse="true" status="true">
<wps:Output asReference="false">
<ows:Identifier>result</ows:Identifier>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:BufferFeatureCollection</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wps" method="POST">
<wps:Body>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:CollectGeometries</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:geonode="http://www.geonode.org/">
<wfs:Query typeName="geonode:san_andres_y_providencia_administrative"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput lineage="true" mimeType="text/xml; subtype=gml/3.1.1">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>distance</ows:Identifier>
<wps:Data>
<wps:LiteralData>0.005</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument lineage="true" storeExecuteResponse="true" status="true">
<wps:Output asReference="false">
<ows:Identifier>result</ows:Identifier>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>
<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>gs:Clip</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:geonode="http://www.geonode.org/">
<wfs:Query typeName="geonode:san_andres_y_providencia_administrative"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>clip</ows:Identifier>
<wps:Data>
<wps:ComplexData mimeType="application/json"><![CDATA[{"type":"MultiLineString","coordinates":[[[-81.8254,12.199],[-81.8162,12.1827],[-81.812,12.1653],[-81.8156,12.1465],[-81.8269,12.1321],[-81.8433,12.123],[-81.8614,12.119],[-81.8795,12.1232],[-81.8953,12.1336],[-81.9049,12.1494],[-81.9087,12.1673],[-81.9054,12.1864],[-81.8938,12.2004],[-81.8795,12.2089],[-81.8593,12.2136],[-81.8399,12.2096],[-81.8254,12.199]],[[-81.6565,12.635],[-81.6808,12.6391],[-81.7085,12.6262],[-81.739,12.6046],[-81.7611,12.5775],[-81.775,12.5397],[-81.7708,12.5207],[-81.7667,12.4971],[-81.7701,12.4748],[-81.7646,12.4504],[-81.739,12.4369],[-81.7022,12.4389],[-81.6835,12.4578],[-81.6794,12.4883],[-81.6676,12.5153],[-81.651,12.541],[-81.66,12.5552],[-81.6489,12.5762],[-81.6274,12.5931],[-81.6309,12.6181],[-81.6565,12.635]],[[-81.2954,13.3496],[-81.3004,13.3132],[-81.3143,13.29],[-81.3413,13.2755],[-81.3731,13.2674],[-81.4058,13.2657],[-81.4335,13.2633],[-81.4531,13.2771],[-81.4574,13.3079],[-81.4663,13.3257],[-81.463,13.3476],[-81.447,13.3674],[-81.4228,13.3879],[-81.412,13.4126],[-81.403,13.4375],[-81.391,13.4582],[-81.3674,13.4687],[-81.3503,13.4574],[-81.3205,13.448],[-81.2941,13.4177],[-81.2846,13.3878],[-81.2954,13.3496]],[[-79.9333,14.9856],[-79.9333,15.5028]]]}]]></wps:ComplexData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument lineage="true" storeExecuteResponse="true" status="true">
<wps:Output asReference="false">
<ows:Identifier>result</ows:Identifier>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>