WPS: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
(+vtk-grass-bridge)
Line 141: Line 141:


</pre>
</pre>
=== 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.
'''Example'''
  # 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 other software ===
=== Linking to other software ===

Revision as of 12:28, 21 March 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>Generates a raster map layer with contiguous areas grown by one cell.</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>
				<ows:Abstract>Name of input raster map</ows:Abstract>
				<ComplexData maximumMegabytes="2048">
					<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>
				</ComplexData>
			</Input>
			<Input minOccurs="0" maxOccurs="1">
				<ows:Identifier>radius</ows:Identifier>
				<ows:Title>Radius of buffer in raster cells</ows:Title>
				<ows:Abstract>Radius of buffer in raster cells</ows:Abstract>
				<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>
				<ows:Abstract>Metric</ows:Abstract>
				<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>
				<ows:Abstract>Value to write for input cells which are non-NULL (-1 => NULL)</ows:Abstract>
				<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>
				<ows:Abstract>Value to write for "grown" cells</ows:Abstract>
				<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>
				<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 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.

Example

 # 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 other software

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