Process Chaining¶
GeoServer WPS implements also the Process Chaining
. As the wording suggests, this is a method of “nesting” different processes inputs/outputs in order to get a chain of operations composing a unique more complex Process.
WPS Process Chaining
is a way to:
- Feeding the output of a process into another process
- Allowing for tree-like composition
Lets see a couple of Process Chaining examples:
- Extract the rivers into the “restricted areas” polygons
- Extract the shape of the USA out of a raster, providing the
topp:states
FeatureCollection
Chain 1: Extract the rivers into the “restricted areas” polygons¶
During this exercise we will perform a gs:Clip
of the Vector Layer sf:streams
against the FeatureCollection collected from the Vector Layer sf:restricted
.
Vector clip and ship¶
Once started the GeoServer Trunk on port 8085 (WPS - Startup the service section), go to the
Demo WPS Request Builder
interface, and selectgs:Clip
from the firstcombo-box
. Select the Vector Layersf:streams
as input.Now, for the
clip
input selectSUBPROCESS
and then click onDefine/edit
. Another WPS Builder dialog window should appear.On the new WPS Browser window select the process
gs:CollectGeometries
using the Vector Layersf:restricted
, thenApply
Finally select
application/zip
as output format and thenExecute Process
After few instants you will be able to download a zip file containing a shapefile. Open the latter using
uDig
orQGis
in order to inspect the outcomes
Chain 2: Extract the shape of the USA out of a raster, providing the topp:states
FeatureCollection¶
During this exercise we will perform a gs:CropCoverage
of the Raster Layer nurc:Img_Sample
against the FeatureCollection collected from the Vector Layer topp:states
.
Raster clip and ship¶
Once started the GeoServer Trunk on port 8085 (WPS - Startup the service section), go to the
Demo WPS Request Builder
interface, and selectgs:CropCoverage
from the firstcombo-box
. Select the Raster Layernurc:Img_Sample
as input.Now, for the
cropGeometry
input selectSUBPROCESS
and then click onDefine/edit
. Another WPS Builder dialog window should appear. On the new WPS Browser window select the processgs:CollectGeometries
using the Vector Layertopp:states
, thenApply
Leave
image/tiff
as output format for the Process and proceed with theExecute Process
GeoServer “direct data integration” and “store Back”” capabilities throught gs:Import
¶
Direct data integration¶
The WPS normally streams input data from remote WFS/WCS, parsing GML/GeoJSON or GeoTiff/ArcGrid. On the GeoServer implementation when the source is local we can dodge it though, read directly from the source (shapefile, DBMS, geotiff).
The following two special functions do the trick
http://geoserver/wfs
; url for local WFS accesshttp://geoserver/wcs
; url for local WCS access
Store Back`` with ``gs:Import``¶
The gs:Import
WPS Process along with Process Chaining
can be successfully used to store back the outcomes as new GeoServer resources/layers.
gs:Import
saves the vector results into a store of choice, and publish as a layer. The new resource can be used right away from WMS/WFS/WCS/WPS.
Attention
At this time GeoServer still missing the equivalent for rasters.
As an example, we will now store back into GeoServer the layer of reduced sf:roads
created in the section Vector Processes
Once started the GeoServer Trunk on port 8085 (WPS - Startup the service section), go to the
Demo WPS Request Builder
interface, and selectgs:Import
from the firstcombo-box
As input for
features
selectSUBPROCESS
, click onDetails/edit
and configure ags:Clip
Process on the Vector Layersf:roads
following the steps at Vector Processes sectionAttention
Don’t forget to specify the clipping geometry as WKT:
POLYGON((589800.30577 4927510.97152, 589800.30577 4926799.69435, 590874.57957 4926799.69435, 590874.57957 4927510.97152, 589800.30577 4927510.97152))
Click on
Apply
in order to let the Demo WPS Builder insert the Execute Process XML of thegs:Clip
chained sub-process into thetext-area
Fill in the other attributes
workspace
; sfname
; roads_clippedsrs
; EPSG:26713 (thesf:roads
native one)style
; simple_roads (the default style to be assigned to the layer)
Click on the
Execute Process
and when finished check throught the GeoServerLayer Preview
that the new layer has been created and is clipped