WPS: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
No edit summary
(cosmetics)
 
(25 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== GRASS based OGC Web Processing Service (WPS) standard implementations ==
'''GRASS based OGC Web Processing Service (WPS) standard implementations'''


The OGC Web Processing Service (WPS) {{wikipedia||Web Processing Service}} interface standard provides rules for standardizing how inputs and outputs (requests and responses) for invoking geospatial processing services as a web service. GRASS GIS can be used as backend in several WPS service frameworks.


=== Inside GRASS 7 ===
== 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 '''other WPS implementations''' which use GRASS as GIS backbone:
* '''PyWPS''': http://pywps.wald.intevation.org/
** PyWPS and wps-grass-bridge connector: http://code.google.com/p/wps-grass-bridge/wiki/PyWPS_Integration
** [http://pywps.wald.intevation.org/gallery/index.html Gallery] (live examples)
** PyWPS and GRASS Wiki: http://pywps.wikispaces.com/GRASS
* '''WPS by 52N''': http://52north.org/maven/project-sites/wps/52n-wps-site/
** Connecting to GRASS out of the box: http://52north.org/maven/project-sites/wps/52n-wps-webapp/
** 52N-WPS-GRASS [http://geoprocessing.demo.52north.org:8080/wps/WebProcessingService?REQUEST=GetCapabilities&SERVICE=WPS&VERSION=1.0.0 Demo]
* '''ZOO project''' - Open OSW Platform: http://www.zoo-project.org/
** [http://zoo-project.org/trac/wiki/ZooWebSite/QGIS_WPS_Client ZOO-WPS with GRASS and QGIS]
* R and WPS: [http://gsif.r-forge.r-project.org/WPS.html WPS class]
 
== Inside GRASS 7 ==


In GRASS7, the WPS process description can be automatically generated with the option '--wps-process-description'.
In GRASS7, the WPS process description can be automatically generated with the option '--wps-process-description'.
Line 8: Line 29:


Example:
Example:
r.grow --wps-process-description


r.grow --wps-process-description
<source lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<wps:ProcessDescriptions xmlns:wps="http://www.opengis.net/wps/1.0.0"
<wps:ProcessDescriptions xmlns:wps="http://www.opengis.net/wps/1.0.0"
Line 17: Line 40:
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/png</MimeType>
                                                        <MimeType>application/x-netcdf</MimeType>
</Format>
                                                </Format>
<Format>
                                        </Supported>
<MimeType>application/grass-raster-ascii</MimeType>
                                </ComplexData>
</Format>
                        </Input>
<Format>
                        <Input minOccurs="0" maxOccurs="1">
<MimeType>application/grass-raster-binary</MimeType>
                                <ows:Identifier>radius</ows:Identifier>
</Format>
                                <ows:Title>Radius of buffer in raster cells</ows:Title>
</Supported>
                                <LiteralData>
</ComplexData>
                                        <ows:DataType ows:reference="xs:float">float</ows:DataType>
</Input>
                                        <ows:AnyValue/>
<Input minOccurs="0" maxOccurs="1">
                                        <DefaultValue>1.01</DefaultValue>
<ows:Identifier>radius</ows:Identifier>
                                </LiteralData>
<ows:Title>Radius of buffer in raster cells</ows:Title>
                        </Input>
<ows:Abstract>Radius of buffer in raster cells</ows:Abstract>
                        <Input minOccurs="0" maxOccurs="1">
<LiteralData>
                                <ows:Identifier>metric</ows:Identifier>
<ows:DataType ows:reference="xs:float">float</ows:DataType>
[...]
<ows:AnyValue/>
                        </Input>
<DefaultValue>1.01</DefaultValue>
                        <Input minOccurs="0" maxOccurs="1">
</LiteralData>
                                <ows:Identifier>grass_band_number</ows:Identifier>
</Input>
                                <ows:Title>Band to select for processing (default is all bands)</ows:Title>
<Input minOccurs="0" maxOccurs="1">
                                <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>
<ows:Identifier>metric</ows:Identifier>
                                <LiteralData>
<ows:Title>Metric</ows:Title>
                                        <ows:DataType ows:reference="xs:integer">integer</ows:DataType>
<ows:Abstract>Metric</ows:Abstract>
                                        <ows:AnyValue/>
<LiteralData>
                                </LiteralData>
<ows:DataType ows:reference="xs:string">string</ows:DataType>
                        </Input>
<ows:AllowedValues>
                </DataInputs>
<ows:Value>euclidean</ows:Value>
                <ProcessOutputs>
<ows:Value>maximum</ows:Value>
                        <Output>
<ows:Value>manhattan</ows:Value>
                                <ows:Identifier>output</ows:Identifier>
</ows:AllowedValues>
                                <ows:Title>Name for output raster map</ows:Title>
<DefaultValue>euclidean</DefaultValue>
                                <ComplexOutput>
</LiteralData>
                                        <Default>
</Input>
                                                <Format>
<Input minOccurs="0" maxOccurs="1">
                                                        <MimeType>image/tiff</MimeType>
<ows:Identifier>old</ows:Identifier>
                                                </Format>
<ows:Title>Value to write for input cells which are non-NULL (-1 =&gt; NULL)</ows:Title>
                                        </Default>
<ows:Abstract>Value to write for input cells which are non-NULL (-1 =&gt; NULL)</ows:Abstract>
                                        <Supported>
<LiteralData>
                                                <Format>
<ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                                                        <MimeType>image/tiff</MimeType>
<ows:AnyValue/>
                                                </Format>
</LiteralData>
[...]
</Input>
                                                <Format>
<Input minOccurs="0" maxOccurs="1">
                                                        <MimeType>application/x-netcdf</MimeType>
<ows:Identifier>new</ows:Identifier>
                                                </Format>
<ows:Title>Value to write for "grown" cells</ows:Title>
                                        </Supported>
<ows:Abstract>Value to write for "grown" cells</ows:Abstract>
                                </ComplexOutput>
<LiteralData>
                        </Output>
<ows:DataType ows:reference="xs:integer">integer</ows:DataType>
                </ProcessOutputs>
<ows:AnyValue/>
        </ProcessDescription>
</LiteralData>
</Input>
<Input minOccurs="0" maxOccurs="1">
<ows:Identifier>-m</ows:Identifier>
<ows:Title>radius is in map units rather than cells</ows:Title>
<ows:Abstract>radius is in map units rather than cells</ows:Abstract>
<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>
</DataInputs>
<ProcessOutputs>
<Output>
<ows:Identifier>output</ows:Identifier>
<ows:Title>Name for output raster map</ows:Title>
<ows:Abstract>Name for output raster map</ows:Abstract>
<ComplexOutput>
<Default>
<Format>
<MimeType>image/tiff</MimeType>
</Format>
</Default>
<Supported>
<Format>
<MimeType>image/tiff</MimeType>
</Format>
<Format>
<MimeType>image/png</MimeType>
</Format>
<Format>
<MimeType>application/grass-raster-ascii</MimeType>
</Format>
<Format>
<MimeType>application/grass-raster-binary</MimeType>
</Format>
</Supported>
</ComplexOutput>
</Output>
</ProcessOutputs>
</ProcessDescription>
</wps:ProcessDescriptions>
</wps:ProcessDescriptions>
</source>


== WPS workflow idea ==


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


=== Linking to other software ===
'''Preparations'''


There are currently several WPS implementations which use GRASS as GIS backbone:
GRASS can be used in an automated way by just defining a set of variables. See here for [[GRASS_and_Shell#Setting_the_variables|GRASS and Shell]] settings and [[GRASS_and_Python#Creating_Python_scripts_that_call_GRASS_functionality_from_outside|GRASS and Python]].
* PyWPS: http://pywps.wald.intevation.org/
 
** [http://pywps.wald.intevation.org/gallery/index.html Gallery] (live examples)
'''Data flow example'''
* WPS by 52n: http://52north.org/maven/project-sites/wps/52n-wps-site/
 
* ZOO project - Open OSW Platform: http://www.zoo-project.org/
The script content could be looking like this:
 
<source lang="bash">
# register (rather than import) a GeoTIFF file in GRASS GIS:
r.external input=terra_lst1km20030314.LST_Day.tif output=modis_celsius
# define output directory for files resulting from subsequent calculations:
r.external.out directory=$HOME/gisoutput/ format="GTiff"
# perform calculations (here: extract pixels > 20 deg C)
# store output directly as GeoTIFF file, hence add the .tif extension:
r.mapcalc "warm.tif = if(modis_celsius > 20.0, modis_celsius, null() )"
# cease GDAL output connection and turn back to write standard GRASS raster files:
r.external.out -r
# use the result elsewhere
qgis $HOME/gisoutput/warm.tif
</source>
 
== References ==
 
* List of [http://scholar.google.com/scholar?hl=en&q=%2Bgrass+%2Bgis+%2Bwps&as_sdt=2001&as_ylo=&as_vis=0 GRASS-WPS articles]
* [http://www.youtube.com/watch?v=zCnax9w1bCs PyWPS GRASS GIS 7 and QGIS with WPS plugin in action]
* [http://code.google.com/p/wps-grass-bridge/wiki/PyWPS_Integration  PyWPS integration]
 
Videos:
* [http://www.youtube.com/watch?v=zCnax9w1bCs PyWPS GRASS GIS 7 and QGIS with WPS plugin in action]
* [http://www.youtube.com/watch?v=jg2pb_Xjq8Y Development of an Open Cloud GIS with GRASS GIS, PyWPS, the wps-grass-bridge and QGIS]
 
== Historical note: GRASSLinks as a precursor to WPS ==
* GRASSLinks was originally developed from 1994-98 by Dr. Susan Huse at the Research Program in Environmental Planning and GIS (REGIS), at the University of California, Berkeley. This is claimed to be the first fully funcional online GIS package offering public domain access to environmental and geographical data.
* [http://uspest.org/glinks35/ OSU IPPC GRASSLinks 3.5beta: A web interface for GRASS GIS version 5.x]


[[Category: Development]]
[[Category:Development]]
[[Category: OGC]]
[[Category:OGC]]
[[Category:Linking to other languages]]

Latest revision as of 19:09, 7 October 2015

GRASS based OGC Web Processing Service (WPS) standard implementations

The OGC Web Processing Service (WPS) Web Processing Service interface standard provides rules for standardizing how inputs and outputs (requests and responses) for invoking geospatial processing services as a web service. GRASS GIS can be used as backend in several WPS service frameworks.

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 other WPS implementations which use GRASS as GIS backbone:

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>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>
[...]
                         </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>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 (rather than import) a GeoTIFF file in GRASS GIS:
r.external input=terra_lst1km20030314.LST_Day.tif output=modis_celsius
 
# define output directory for files resulting from subsequent calculations:
r.external.out directory=$HOME/gisoutput/ format="GTiff"
 
# perform calculations (here: extract pixels > 20 deg C)
# store output directly as GeoTIFF file, hence add the .tif extension:
r.mapcalc "warm.tif = if(modis_celsius > 20.0, modis_celsius, null() )"
 
# cease GDAL output connection and turn back to write standard GRASS raster files:
r.external.out -r
 
# use the result elsewhere
qgis $HOME/gisoutput/warm.tif

References

Videos:

Historical note: GRASSLinks as a precursor to WPS

  • GRASSLinks was originally developed from 1994-98 by Dr. Susan Huse at the Research Program in Environmental Planning and GIS (REGIS), at the University of California, Berkeley. This is claimed to be the first fully funcional online GIS package offering public domain access to environmental and geographical data.
  • OSU IPPC GRASSLinks 3.5beta: A web interface for GRASS GIS version 5.x