How to store WPS outputs in Geoserver
You can store your WPS process outputs directly in Geoserver using the RESTful interface. Raster and vector data can be stored and made available as WFS, WMS or WCS layer.
Storing raster or vector data in a WMS layer
First, you will have to configure the Geoserver WMS generator. You can do this via the Admin Console:
or directly in the wps_config.xml:
<Generator name="WMSGenerator"
className="org.n52.wps.io.datahandler.generator.GeoserverWMSGenerator"
active="true">
<Format mimetype="application/WMS" />
<Property name="Geoserver_username" active="true">admin</Property>
<Property name="Geoserver_password" active="true">password</Property>
<Property name="Geoserver_host" active="true">localhost</Property>
<Property name="Geoserver_port" active="true">8181</Property>
</Generator>
The following are the supported data bindings of the Geoserver WMS generator:
!GTRasterDataBinding.class
!ShapefileBinding.class
!GeotiffBinding.class
!GTVectorDataBinding.class
If you create a new process, make sure one of these binding is supported as output.The mime type "application/WMS" should appear in the ProcessDescription after you activated the generator.
Storing raster data in a WCS layer
First, you will have to configure the Geoserver WCS generator. You can do this via the Admin Console (see WMS generator),or directly in the wps_config.xml:
<Generator name="WCSGenerator"
className="org.n52.wps.io.datahandler.generator.GeoserverWCSGenerator"
active="true">
<Format mimetype="application/WCS" />
<Property name="Geoserver_username" active="true">admin</Property>
<Property name="Geoserver_password" active="true">password</Property>
<Property name="Geoserver_host" active="true">localhost</Property>
<Property name="Geoserver_port" active="true">8181</Property>
</Generator>
The following are the supported data bindings of the Geoserver WCS generator:
!GTRasterDataBinding.class
!GeotiffBinding.class
If you create a new process, make sure one of these binding is supported as output.The mime type "application/WCS" should appear in the ProcessDescription after you activated the generator.
Storing vector data in a WFS layer
First, you will have to configure the Geoserver WFS generator. You can do this via the Admin Console (see WMS generator),or directly in the wps_config.xml:
<Generator name="WFSGenerator"
className="org.n52.wps.io.datahandler.generator.GeoserverWFSGenerator"
active="true">
<Format mimetype="application/WFS" />
<Property name="Geoserver_username" active="true">admin</Property>
<Property name="Geoserver_password" active="true">password</Property>
<Property name="Geoserver_host" active="true">localhost</Property>
<Property name="Geoserver_port" active="true">8181</Property>
</Generator>
The following are the supported data bindings of the Geoserver WCS generator:
!GTVectorDataBinding.class
If you create a new process, make sure this binding is supported as output.The mime type "application/WFS" should appear in the ProcessDescription after you activated the generator.
Configuring output storing in Geoserver in the ExecuteRequest
In order to store the process output in a Geoserver instance, the ResponseForm element of the ExecuteRequest must look like the following (similar for WMS and WCS):
<wps:ResponseForm>
<wps:ResponseDocument>
<wps:Output mimeType="application/WFS">
<ows:Identifier>result</ows:Identifier>
<ows:Title>result</ows:Title>
<ows:Abstract>result</ows:Abstract>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>
If you are using the Client API, the following lines will create an ExecuteRequest accordingly:
ExecuteRequestBuilder executeBuilder = new org.n52.wps.client.ExecuteRequestBuilder(
processDescription);
executeBuilder.setMimeTypeForOutput("application/WFS", process_output);
In the following you can see a ResponseDocument, where the layer name (ResourceID) and the WFS GetCapabilities link is stated:
<?xml version="1.0" encoding="UTF-8"?>
<ns:ExecuteResponse xmlns:ns="http://www.opengis.net/wps/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
http://schemas.opengis.net/wps/1.0.0/wpsExecute_response.xsd" serviceInstance="http://localhost:8080/wps/WebProcessingService?REQUEST=GetCapabilities&SERVICE=WPS" xml:lang="en-US" service="WPS" version="1.0.0">
<ns:Process ns:processVersion="1.1.0">
<ns1:Identifier xmlns:ns1="http://www.opengis.net/ows/1.1">org.n52.wps.server.algorithm.SimpleBufferAlgorithm</ns1:Identifier>
<ns1:Title xmlns:ns1="http://www.opengis.net/ows/1.1">org.n52.wps.server.algorithm.SimpleBufferAlgorithm</ns1:Title>
</ns:Process>
<ns:Status creationTime="2013-06-12T11:27:22.606+02:00">
<ns:ProcessSucceeded>Process successful</ns:ProcessSucceeded>
</ns:Status>
<ns:ProcessOutputs>
<ns:Output>
<ns1:Identifier xmlns:ns1="http://www.opengis.net/ows/1.1">result</ns1:Identifier>
<ns1:Title xmlns:ns1="http://www.opengis.net/ows/1.1">result</ns1:Title>
<ns:Data>
<ns:ComplexData mimeType="application/WFS"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><OWSResponse type="WFS"><ResourceID>N52:Shape_73e0415e-e973-4ee9-a070-9b0e42222a3b3859765591135812303</ResourceID>
<GetCapabilitiesLink>http://geoprocessing.demo.52north.org:8080/geoserver/wfs?Service=WFS&Request=GetCapabilities&Version=1.1.0</GetCapabilitiesLink></OWSResponse>]]></ns:ComplexData>
</ns:Data>
</ns:Output>
</ns:ProcessOutputs>
</ns:ExecuteResponse>
The follwing image shows an example WPS output as WFS layer (OpenLayers-style):
This is the respective
link.