WPS: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
No edit summary
Line 11: Line 11:
<pre>
<pre>
r.grow --wps-process-description
r.grow --wps-process-description


<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
Line 20: Line 19:
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
xsi:schemaLocation="http://www.opengis.net/wps/1.0.0
  http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd"
  http://schemas.opengis.net/wps/1.0.0/wpsDescribeProcess_response.xsd"
  service="WPS" version="1.0.0" xml:lang="en-US">  
  service="WPS" version="1.0.0" xml:lang="en-US">
<ProcessDescription wps:processVersion="1" storeSupported="true" statusSupported="true">
        <ProcessDescription wps:processVersion="1" storeSupported="true" statusSupported="true">
<ows:Identifier>r.grow</ows:Identifier>
                <ows:Identifier>r.grow</ows:Identifier>
<ows:Title>Generates a raster map layer with contiguous areas grown by one cell.</ows:Title>
                <ows:Title>Generates a raster map layer with contiguous areas grown by one cell.</ows:Title>
<ows:Abstract>Generates a raster map layer with contiguous areas grown by one cell.</ows:Abstract>
                <ows:Abstract>The manual page of this module is available here: http://grass.osgeo.org/grass70/manuals/html70_user/r.grow.html</ows:Abstract>
<ows:Metadata xlink:title="raster" />
                <ows:Metadata xlink:title="raster" />
<DataInputs>
                <DataInputs>
<Input minOccurs="1" maxOccurs="1">
                        <Input minOccurs="1" maxOccurs="1">
<ows:Identifier>input</ows:Identifier>
                                <ows:Identifier>input</ows:Identifier>
<ows:Title>Name of input raster map</ows:Title>
                                <ows:Title>Name of input raster map</ows:Title>
<ows:Abstract>Name of input raster map</ows:Abstract>
                                <ComplexData maximumMegabytes="2048">
<ComplexData maximumMegabytes="2048">
                                        <Default>
<Default>
                                                <Format>
<Format>
                                                        <MimeType>image/tiff</MimeType>
<MimeType>image/tiff</MimeType>
                                                </Format>
</Format>
                                        </Default>
</Default>
                                        <Supported>
<Supported>
                                                <Format>
<Format>
                                                        <MimeType>image/tiff</MimeType>
<MimeType>image/tiff</MimeType>
                                                </Format>
</Format>
                                                <Format>
<Format>
                                                        <MimeType>image/geotiff</MimeType>
<MimeType>image/png</MimeType>
                                                </Format>
</Format>
                                                <Format>
<Format>
                                                        <MimeType>application/geotiff</MimeType>
<MimeType>application/grass-raster-ascii</MimeType>
                                                </Format>
</Format>
                                                <Format>
<Format>
                                                        <MimeType>application/x-geotiff</MimeType>
<MimeType>application/grass-raster-binary</MimeType>
                                                </Format>
</Format>
                                                <Format>
</Supported>
                                                        <MimeType>image/png</MimeType>
</ComplexData>
                                                </Format>
</Input>
                                                <Format>
<Input minOccurs="0" maxOccurs="1">
                                                        <MimeType>image/gif</MimeType>
<ows:Identifier>radius</ows:Identifier>
                                                </Format>
<ows:Title>Radius of buffer in raster cells</ows:Title>
                                                <Format>
<ows:Abstract>Radius of buffer in raster cells</ows:Abstract>
                                                        <MimeType>image/jpeg</MimeType>
<LiteralData>
                                                </Format>
<ows:DataType ows:reference="xs:float">float</ows:DataType>
                                                <Format>
<ows:AnyValue/>
                                                        <MimeType>application/x-erdas-hfa</MimeType>
<DefaultValue>1.01</DefaultValue>
                                                </Format>
</LiteralData>
                                                <Format>
</Input>
                                                        <MimeType>application/netcdf</MimeType>
<Input minOccurs="0" maxOccurs="1">
                                                </Format>
<ows:Identifier>metric</ows:Identifier>
                                                <Format>
<ows:Title>Metric</ows:Title>
                                                        <MimeType>application/x-netcdf</MimeType>
<ows:Abstract>Metric</ows:Abstract>
                                                </Format>
<LiteralData>
                                        </Supported>
<ows:DataType ows:reference="xs:string">string</ows:DataType>
                                </ComplexData>
<ows:AllowedValues>
                        </Input>
<ows:Value>euclidean</ows:Value>
                        <Input minOccurs="0" maxOccurs="1">
<ows:Value>maximum</ows:Value>
                                <ows:Identifier>radius</ows:Identifier>
<ows:Value>manhattan</ows:Value>
                                <ows:Title>Radius of buffer in raster cells</ows:Title>
</ows:AllowedValues>
                                <LiteralData>
<DefaultValue>euclidean</DefaultValue>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
</LiteralData>
                                        <ows:AnyValue/>
</Input>
                                        <DefaultValue>1.01</DefaultValue>
<Input minOccurs="0" maxOccurs="1">
                                </LiteralData>
<ows:Identifier>old</ows:Identifier>
                        </Input>
<ows:Title>Value to write for input cells which are non-NULL (-1 =&gt; NULL)</ows:Title>
                        <Input minOccurs="0" maxOccurs="1">
<ows:Abstract>Value to write for input cells which are non-NULL (-1 =&gt; NULL)</ows:Abstract>
                                <ows:Identifier>metric</ows:Identifier>
<LiteralData>
                                <ows:Title>Metric</ows:Title>
<ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                                <LiteralData>
<ows:AnyValue/>
                                        <ows:DataType ows:reference="xs:string">string</ows:DataType>
</LiteralData>
                                        <ows:AllowedValues>
</Input>
                                                <ows:Value>euclidean</ows:Value>
<Input minOccurs="0" maxOccurs="1">
                                                <ows:Value>maximum</ows:Value>
<ows:Identifier>new</ows:Identifier>
                                                <ows:Value>manhattan</ows:Value>
<ows:Title>Value to write for "grown" cells</ows:Title>
                                        </ows:AllowedValues>
<ows:Abstract>Value to write for "grown" cells</ows:Abstract>
                                        <DefaultValue>euclidean</DefaultValue>
<LiteralData>
                                </LiteralData>
<ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                        </Input>
<ows:AnyValue/>
                        <Input minOccurs="0" maxOccurs="1">
</LiteralData>
                                <ows:Identifier>old</ows:Identifier>
</Input>
                                <ows:Title>Value to write for input cells which are non-NULL (-1 =&gt; NULL)</ows:Title>
<Input minOccurs="0" maxOccurs="1">
                                <LiteralData>
<ows:Identifier>-m</ows:Identifier>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
<ows:Title>radius is in map units rather than cells</ows:Title>
                                        <ows:AnyValue/>
<ows:Abstract>radius is in map units rather than cells</ows:Abstract>
                                </LiteralData>
<LiteralData>
                        </Input>
<ows:DataType ows:reference="xs:boolean">boolean</ows:DataType>
                        <Input minOccurs="0" maxOccurs="1">
<ows:AllowedValues>
                                <ows:Identifier>new</ows:Identifier>
<ows:Value>true</ows:Value>
                                <ows:Title>Value to write for "grown" cells</ows:Title>
<ows:Value>false</ows:Value>
                                <LiteralData>
</ows:AllowedValues>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
<DefaultValue>false</DefaultValue>
                                        <ows:AnyValue/>
</LiteralData>
                                </LiteralData>
</Input>
                        </Input>
</DataInputs>
                        <Input minOccurs="0" maxOccurs="1">
<ProcessOutputs>
                                <ows:Identifier>-m</ows:Identifier>
<Output>
                                <ows:Title>radius is in map units rather than cells</ows:Title>
<ows:Identifier>output</ows:Identifier>
                                <LiteralData>
<ows:Title>Name for output raster map</ows:Title>
                                        <ows:DataType ows:reference="xs:boolean">boolean</ows:DataType>
<ows:Abstract>Name for output raster map</ows:Abstract>
                                        <ows:AllowedValues>
<ComplexOutput>
                                                <ows:Value>true</ows:Value>
<Default>
                                                <ows:Value>false</ows:Value>
<Format>
                                        </ows:AllowedValues>
<MimeType>image/tiff</MimeType>
                                        <DefaultValue>false</DefaultValue>
</Format>
                                </LiteralData>
</Default>
                        </Input>
<Supported>
                        <Input minOccurs="0" maxOccurs="1">
<Format>
                                <ows:Identifier>grass_resolution_ns</ows:Identifier>
<MimeType>image/tiff</MimeType>
                                <ows:Title>Resolution of the mapset in north-south direction in meters or degrees</ows:Title>
</Format>
                                <ows:Abstract>This parameter defines the north-south resolution of the mapset in meter or degrees, which should be used to process the input and output raster data. To enable this setting, you need to specify north-south and east-west resolution.</ows:Abstract>
<Format>
                                <LiteralData>
<MimeType>image/png</MimeType>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
</Format>
                                        <UOMs>
<Format>
                                                <Default>
<MimeType>application/grass-raster-ascii</MimeType>
                                                        <ows:UOM>meters</ows:UOM>
</Format>
                                                </Default>
<Format>
                                                <Supported>
<MimeType>application/grass-raster-binary</MimeType>
                                                        <ows:UOM>meters</ows:UOM>
</Format>
                                                        <ows:UOM>degrees</ows:UOM>
</Supported>
                                                </Supported>
</ComplexOutput>
                                        </UOMs>
</Output>
                                        <ows:AnyValue/>
</ProcessOutputs>
                                        <DefaultValue>25</DefaultValue>
</ProcessDescription>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>grass_resolution_ew</ows:Identifier>
                                <ows:Title>Resolution of the mapset in east-west direction in meters or degrees</ows:Title>
                                <ows:Abstract>This parameter defines the east-west resolution of the mapset in meters or degrees, which should be used to process the input and output raster data.  To enable this setting, you need to specify north-south and east-west resolution.</ows:Abstract>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
                                        <UOMs>
                                                <Default>
                                                        <ows:UOM>meters</ows:UOM>
                                                </Default>
                                                <Supported>
                                                        <ows:UOM>meters</ows:UOM>
                                                        <ows:UOM>degrees</ows:UOM>
                                                </Supported>
                                        </UOMs>
                                        <ows:AnyValue/>
                                        <DefaultValue>25</DefaultValue>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>grass_band_number</ows:Identifier>
                                <ows:Title>Band to select for processing (default is all bands)</ows:Title>
                                <ows:Abstract>This parameter defines band number of the input raster files which should be processed. As default all bands are processed and used as single and multiple inputs for raster modules.</ows:Abstract>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                                        <ows:AnyValue/>
                                </LiteralData>
                        </Input>
                </DataInputs>
                <ProcessOutputs>
                        <Output>
                                <ows:Identifier>output</ows:Identifier>
                                <ows:Title>Name for output raster map</ows:Title>
                                <ComplexOutput>
                                        <Default>
                                                <Format>
                                                        <MimeType>image/tiff</MimeType>
                                                </Format>
                                        </Default>
                                        <Supported>
                                                <Format>
                                                        <MimeType>image/tiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>image/geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-erdas-hfa</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/netcdf</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-netcdf</MimeType>
                                                </Format>
                                        </Supported>
                                </ComplexOutput>
                        </Output>
                </ProcessOutputs>
        </ProcessDescription>
</wps:ProcessDescriptions>
</wps:ProcessDescriptions>


Line 167: Line 233:
   qgis /srv/gisoutput/warm.tif
   qgis /srv/gisoutput/warm.tif


=== Linking to other software ===
=== Linking to WPS server ===
 
A framework has been developed to make the integration of GRASS GIS 7 in WPS server as easy as possible. The
framework is called wps-grass-bridge and is available here:
* wps-grass-bridge: http://code.google.com/p/wps-grass-bridge/
This framework support currently PyWPS, ZOO WPS and is used by 52North WPS server. Many GRASS GIS 7
modules can be attached out of the box.


There are currently several WPS implementations which use GRASS as GIS backbone:
There are currently several WPS implementations which use GRASS as GIS backbone:
* PyWPS: http://pywps.wald.intevation.org/
* PyWPS: http://pywps.wald.intevation.org/
** PyWPS and  wps-grass-bridge connector: http://code.google.com/p/wps-grass-bridge/wiki/PyPWS
** [http://pywps.wald.intevation.org/gallery/index.html Gallery] (live examples)
** [http://pywps.wald.intevation.org/gallery/index.html Gallery] (live examples)
* WPS by 52n: http://52north.org/maven/project-sites/wps/52n-wps-site/
* WPS by 52n: http://52north.org/maven/project-sites/wps/52n-wps-site/
* ZOO project - Open OSW Platform: http://www.zoo-project.org/
* ZOO project - Open OSW Platform: http://www.zoo-project.org/
* vtk-grass-bridge: http://code.google.com/p/vtk-grass-bridge/


=== References ===
=== References ===

Revision as of 12:16, 20 November 2010

GRASS based OGC Web Processing Service (WPS) standard implementations

Inside GRASS 7

In GRASS7, the WPS process description can be automatically generated with the option '--wps-process-description'. See announcement.

Example:

r.grow --wps-process-description

<?xml version="1.0" encoding="UTF-8"?>
<wps:ProcessDescriptions xmlns:wps="http://www.opengis.net/wps/1.0.0"
xmlns:ows="http://www.opengis.net/ows/1.1"
xmlns:xlink="http://www.w3.org/1999/xlink"
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/wpsDescribeProcess_response.xsd"
 service="WPS" version="1.0.0" xml:lang="en-US">
        <ProcessDescription wps:processVersion="1" storeSupported="true" statusSupported="true">
                <ows:Identifier>r.grow</ows:Identifier>
                <ows:Title>Generates a raster map layer with contiguous areas grown by one cell.</ows:Title>
                <ows:Abstract>The manual page of this module is available here: http://grass.osgeo.org/grass70/manuals/html70_user/r.grow.html</ows:Abstract>
                <ows:Metadata xlink:title="raster" />
                <DataInputs>
                        <Input minOccurs="1" maxOccurs="1">
                                <ows:Identifier>input</ows:Identifier>
                                <ows:Title>Name of input raster map</ows:Title>
                                <ComplexData maximumMegabytes="2048">
                                        <Default>
                                                <Format>
                                                        <MimeType>image/tiff</MimeType>
                                                </Format>
                                        </Default>
                                        <Supported>
                                                <Format>
                                                        <MimeType>image/tiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>image/geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>image/png</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>image/gif</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>image/jpeg</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-erdas-hfa</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/netcdf</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-netcdf</MimeType>
                                                </Format>
                                        </Supported>
                                </ComplexData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>radius</ows:Identifier>
                                <ows:Title>Radius of buffer in raster cells</ows:Title>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
                                        <ows:AnyValue/>
                                        <DefaultValue>1.01</DefaultValue>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>metric</ows:Identifier>
                                <ows:Title>Metric</ows:Title>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:string">string</ows:DataType>
                                        <ows:AllowedValues>
                                                <ows:Value>euclidean</ows:Value>
                                                <ows:Value>maximum</ows:Value>
                                                <ows:Value>manhattan</ows:Value>
                                        </ows:AllowedValues>
                                        <DefaultValue>euclidean</DefaultValue>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>old</ows:Identifier>
                                <ows:Title>Value to write for input cells which are non-NULL (-1 => NULL)</ows:Title>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                                        <ows:AnyValue/>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>new</ows:Identifier>
                                <ows:Title>Value to write for "grown" cells</ows:Title>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                                        <ows:AnyValue/>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>-m</ows:Identifier>
                                <ows:Title>radius is in map units rather than cells</ows:Title>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:boolean">boolean</ows:DataType>
                                        <ows:AllowedValues>
                                                <ows:Value>true</ows:Value>
                                                <ows:Value>false</ows:Value>
                                        </ows:AllowedValues>
                                        <DefaultValue>false</DefaultValue>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>grass_resolution_ns</ows:Identifier>
                                <ows:Title>Resolution of the mapset in north-south direction in meters or degrees</ows:Title>
                                <ows:Abstract>This parameter defines the north-south resolution of the mapset in meter or degrees, which should be used to process the input and output raster data. To enable this setting, you need to specify north-south and east-west resolution.</ows:Abstract>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
                                        <UOMs>
                                                <Default>
                                                        <ows:UOM>meters</ows:UOM>
                                                </Default>
                                                <Supported>
                                                        <ows:UOM>meters</ows:UOM>
                                                        <ows:UOM>degrees</ows:UOM>
                                                </Supported>
                                        </UOMs>
                                        <ows:AnyValue/>
                                        <DefaultValue>25</DefaultValue>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>grass_resolution_ew</ows:Identifier>
                                <ows:Title>Resolution of the mapset in east-west direction in meters or degrees</ows:Title>
                                <ows:Abstract>This parameter defines the east-west resolution of the mapset in meters or degrees, which should be used to process the input and output raster data.  To enable this setting, you need to specify north-south and east-west resolution.</ows:Abstract>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
                                        <UOMs>
                                                <Default>
                                                        <ows:UOM>meters</ows:UOM>
                                                </Default>
                                                <Supported>
                                                        <ows:UOM>meters</ows:UOM>
                                                        <ows:UOM>degrees</ows:UOM>
                                                </Supported>
                                        </UOMs>
                                        <ows:AnyValue/>
                                        <DefaultValue>25</DefaultValue>
                                </LiteralData>
                        </Input>
                        <Input minOccurs="0" maxOccurs="1">
                                <ows:Identifier>grass_band_number</ows:Identifier>
                                <ows:Title>Band to select for processing (default is all bands)</ows:Title>
                                <ows:Abstract>This parameter defines band number of the input raster files which should be processed. As default all bands are processed and used as single and multiple inputs for raster modules.</ows:Abstract>
                                <LiteralData>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                                        <ows:AnyValue/>
                                </LiteralData>
                        </Input>
                </DataInputs>
                <ProcessOutputs>
                        <Output>
                                <ows:Identifier>output</ows:Identifier>
                                <ows:Title>Name for output raster map</ows:Title>
                                <ComplexOutput>
                                        <Default>
                                                <Format>
                                                        <MimeType>image/tiff</MimeType>
                                                </Format>
                                        </Default>
                                        <Supported>
                                                <Format>
                                                        <MimeType>image/tiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>image/geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-geotiff</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-erdas-hfa</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/netcdf</MimeType>
                                                </Format>
                                                <Format>
                                                        <MimeType>application/x-netcdf</MimeType>
                                                </Format>
                                        </Supported>
                                </ComplexOutput>
                        </Output>
                </ProcessOutputs>
        </ProcessDescription>
</wps:ProcessDescriptions>

WPS workflow idea

External raster maps can directly be linked into GRASS with r.external which saves time and disk space. Additionally, there is no more need to store results in the internal GRASS format - with r.external.out the resulting maps are directly written to a GDAL supported format.

Preparations

GRASS can be used in an automated way by just defining a set of variables. See here for GRASS and Shell settings and GRASS and Python.

Data flow example

The script content could be looking like this:

 # register GeoTIFF file in GRASS database:
 r.external terra_lst1km20030314.LST_Day_1km.rst.tif out=modis_celsius

 # define output directory for GRASS calculation results:
 r.external.out /srv/gisoutput/

 # do something (here: extract pixels > 20°C), write output directly as GeoTIFF:
 r.mapcalc "warm.tif = if(modis_celsius > 20, modis_celsius, null() )"

 # use the result elsewhere
 qgis /srv/gisoutput/warm.tif

Linking to WPS server

A framework has been developed to make the integration of GRASS GIS 7 in WPS server as easy as possible. The framework is called wps-grass-bridge and is available here:

This framework support currently PyWPS, ZOO WPS and is used by 52North WPS server. Many GRASS GIS 7 modules can be attached out of the box.

There are currently several WPS implementations which use GRASS as GIS backbone:

References