In the previous recipe, you installed the WPS module. It's now time to have a look at what it offers you and what can be done with its operations. As it is the easiest way, we will use the WPS request builder to explore geoprocessing operations.
0.01
. As stated by the Help option, the units have to be the same you used when specifying the geometry. In this example, you're using decimal degrees.The WPS process builder is an easy way to use geoprocessing operations. It builds the XML requests for you. This is very useful not only to learn but also to build requests that you may use in another application.
How does the process builder work? It parses the WPS capabilities and renders the information contained in it to a form human-readable. Point your browser to http://localhost/geoserver/ows?service=wps&version=1.0.0&request=GetCapabilities
, and you will see a long XML containing all the operations supported. The following fragment shows the basic operations and the info for JTS:buffer
:
<ows:OperationsMetadata> <ows:Operation name="GetCapabilities"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost/geoserver/wps"/> <ows:Post xlink:href="http://localhost/geoserver/wps"/> </ows:HTTP> </ows:DCP> </ows:Operation> <ows:Operation name="DescribeProcess"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost/geoserver/wps"/> <ows:Post xlink:href="http://localhost/geoserver/wps"/> </ows:HTTP> </ows:DCP> </ows:Operation> <ows:Operation name="Execute"> <ows:DCP> <ows:HTTP> <ows:Get xlink:href="http://localhost/geoserver/wps"/> <ows:Post xlink:href="http://localhost/geoserver/wps"/> </ows:HTTP> </ows:DCP> </ows:Operation> </ows:OperationsMetadata> … <wps:Process wps:processVersion="1.0.0"> <ows:Identifier>JTS:buffer</ows:Identifier> <ows:Title>Buffer</ows:Title> <ows:Abstract>Returns a polygonal geometry representing the input geometry enlarged by a given distance around its exterior.</ows:Abstract> </wps:Process> …
So when you select JTS:buffer
from the list, a DescribeProcess
request is created and forwarded to GeoServer:
http://localhost/geoserver/ows?service=wps&version=1.0.0&request=DescribeProcess&Identifier=JTS:buffer
The WPS process builder receive an XML like the following and it parses it to build the interface to populate processing parameters:
… <ows:Identifier>JTS:buffer</ows:Identifier> <ows:Title>Buffer</ows:Title> <ows:Abstract>Returns a polygonal geometry representing the input geometry enlarged by a given distance around its exterior.</ows:Abstract> <DataInputs> <Input maxOccurs="1" minOccurs="1"> <ows:Identifier>geom</ows:Identifier> <ows:Title>geom</ows:Title> <ows:Abstract>Input geometry</ows:Abstract> <ComplexData> <Default> <Format> <MimeType>text/xml; subtype=gml/3.1.1</MimeType> </Format> </Default> <Supported> <Format> <MimeType>text/xml; subtype=gml/3.1.1</MimeType> </Format> <Format> <MimeType>text/xml; subtype=gml/2.1.2</MimeType> </Format> <Format> <MimeType>application/wkt</MimeType> </Format> <Format> <MimeType>application/gml-3.1.1</MimeType> </Format> <Format> <MimeType>application/gml-2.1.2</MimeType> </Format> </Supported> </ComplexData> …
The described process response contains all information needed to build a proper Process
request. If your input is correct, when you press the Execute Process button, the WPS process builder sends a POST
request with a body similar to this one:
<?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(12.33 42.24)]]> </wps:ComplexData> </wps:Data> </wps:Input> <wps:Input> <ows:Identifier>distance</ows:Identifier> <wps:Data> <wps:LiteralData>0.01</wps:LiteralData> </wps:Data> </wps:Input> </wps:DataInputs> <wps:ResponseForm> <wps:RawDataOutput mimeType="text/xml; subtype=gml/3.1.1"> <ows:Identifier>result</ows:Identifier> </wps:RawDataOutput> </wps:ResponseForm> </wps:Execute>
The result of this operation is the XML showed in the previous screenshot.
3.145.173.199