[Pywps-commits] r372 - in trunk/doc: . pic
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Tue Jun 12 10:35:02 CEST 2007
Author: jachym
Date: 2007-06-12 10:34:48 +0200 (Tue, 12 Jun 2007)
New Revision: 372
Added:
trunk/doc/pic/Rlogo.png
Removed:
trunk/doc/process-2007-03-15.html
Modified:
trunk/doc/Makefile
trunk/doc/install.html
trunk/doc/install.pdf
trunk/doc/install.tex
trunk/doc/install.txt
trunk/doc/pic/pywps-schema.dia
trunk/doc/pic/pywps-schema.png
Log:
updated documentation
Modified: trunk/doc/Makefile
===================================================================
--- trunk/doc/Makefile 2007-06-10 10:42:44 UTC (rev 371)
+++ trunk/doc/Makefile 2007-06-12 08:34:48 UTC (rev 372)
@@ -20,6 +20,12 @@
pdftotext ${FILE}.pdf
lynx -dump ${FILE}.html > ${FILE}.txt
+process:
+ ${SRC}
+ cd ../pywps/Wps/
+ pydoc -w ./process.py
+ mv process.html ../../doc
+ cd -
clean:
rm -f *.aux *.log *.out *.nav *.snm *.toc *~ *.log *.bak all
Modified: trunk/doc/install.html
===================================================================
--- trunk/doc/install.html 2007-06-10 10:42:44 UTC (rev 371)
+++ trunk/doc/install.html 2007-06-12 08:34:48 UTC (rev 372)
@@ -62,7 +62,7 @@
In this file, you can found the description of installation and
configuration of PyWPS script. At the and, you can learn, how to add
your own process to the list of processes. The file describes most recent
-version of PyWPS (<SPAN CLASS="textit">SVN</SPAN>), available in subversion respository.
+version of PyWPS (<SPAN CLASS="textit">2.0.0</SPAN>), available in subversion respository.
<P>
PyPWS project has been started on April 2006 with support of DBU -
@@ -71,7 +71,7 @@
GDF-Hannover (<TT><A NAME="tex2html2"
HREF="http://gdf-hannover.de">http://gdf-hannover.de</A></TT>) and Help Service Remote
Sensing (<TT><A NAME="tex2html3"
- HREF="http:/bnhelp.cz">http:/bnhelp.cz</A></TT>) companies. Initial author is Jachym
+ HREF="http://www.bnhelp.cz">http://www.bnhelp.cz</A></TT>) companies. Initial author is Jachym
Cepicky (<TT><A NAME="tex2html4"
HREF="http://les-ejk.cz">http://les-ejk.cz</A></TT>).
@@ -84,64 +84,67 @@
<!--Table of Contents-->
<UL CLASS="TofC">
-<LI><A NAME="tex2html47"
+<LI><A NAME="tex2html59"
HREF="install.html#SECTION00020000000000000000">Introduction</A>
-<LI><A NAME="tex2html48"
+<UL>
+<LI><A NAME="tex2html60"
+ HREF="install.html#SECTION00021000000000000000">How it works</A>
+</UL>
+<BR>
+<LI><A NAME="tex2html61"
HREF="install.html#SECTION00030000000000000000">Bugs</A>
-<LI><A NAME="tex2html49"
+<LI><A NAME="tex2html62"
HREF="install.html#SECTION00040000000000000000">Installation</A>
<UL>
-<LI><A NAME="tex2html50"
+<LI><A NAME="tex2html63"
HREF="install.html#SECTION00041000000000000000">Installation the quick 'n' dirty way</A>
-<LI><A NAME="tex2html51"
+<LI><A NAME="tex2html64"
HREF="install.html#SECTION00042000000000000000">Installation the 'clean' way</A>
-<LI><A NAME="tex2html52"
+<LI><A NAME="tex2html65"
HREF="install.html#SECTION00043000000000000000">Testing after installation</A>
</UL>
<BR>
-<LI><A NAME="tex2html53"
+<LI><A NAME="tex2html66"
HREF="install.html#SECTION00050000000000000000">Configuration</A>
<UL>
-<LI><A NAME="tex2html54"
+<LI><A NAME="tex2html67"
HREF="install.html#SECTION00051000000000000000">etc/settings.py</A>
-<LI><A NAME="tex2html55"
+<LI><A NAME="tex2html68"
HREF="install.html#SECTION00052000000000000000">etc/grass.py</A>
</UL>
<BR>
-<LI><A NAME="tex2html56"
+<LI><A NAME="tex2html69"
HREF="install.html#SECTION00060000000000000000">Add your own processes</A>
<UL>
-<LI><A NAME="tex2html57"
+<LI><A NAME="tex2html70"
HREF="install.html#SECTION00061000000000000000">Process Initialization and Configuration</A>
-<LI><A NAME="tex2html58"
- HREF="install.html#SECTION00062000000000000000">Running in GRASS session</A>
-<LI><A NAME="tex2html59"
- HREF="install.html#SECTION00063000000000000000">Process Programming</A>
+<LI><A NAME="tex2html71"
+ HREF="install.html#SECTION00062000000000000000">Process Programming</A>
+<LI><A NAME="tex2html72"
+ HREF="install.html#SECTION00063000000000000000">GRASS specific notes</A>
</UL>
<BR>
-<LI><A NAME="tex2html60"
- HREF="install.html#SECTION00070000000000000000">Note to grass programming</A>
-<LI><A NAME="tex2html61"
- HREF="install.html#SECTION00080000000000000000">Testing your new process</A>
-<LI><A NAME="tex2html62"
- HREF="install.html#SECTION00090000000000000000">Using PyWPS</A>
+<LI><A NAME="tex2html73"
+ HREF="install.html#SECTION00070000000000000000">Testing your new process</A>
+<LI><A NAME="tex2html74"
+ HREF="install.html#SECTION00080000000000000000">Using PyWPS</A>
<UL>
-<LI><A NAME="tex2html63"
- HREF="install.html#SECTION00091000000000000000">Input</A>
-<LI><A NAME="tex2html64"
- HREF="install.html#SECTION00092000000000000000">Output</A>
+<LI><A NAME="tex2html75"
+ HREF="install.html#SECTION00081000000000000000">Input</A>
+<LI><A NAME="tex2html76"
+ HREF="install.html#SECTION00082000000000000000">Output</A>
</UL>
<BR>
-<LI><A NAME="tex2html65"
- HREF="install.html#SECTION000100000000000000000">Sample process: addvalue</A>
-<LI><A NAME="tex2html66"
- HREF="install.html#SECTION000110000000000000000">KVP request encoding of addvalue</A>
-<LI><A NAME="tex2html67"
- HREF="install.html#SECTION000120000000000000000">XML request encoding addvalue</A>
-<LI><A NAME="tex2html68"
- HREF="install.html#SECTION000130000000000000000">Licence of PyWPS</A>
-<LI><A NAME="tex2html69"
- HREF="install.html#SECTION000140000000000000000">Licence of this document</A>
+<LI><A NAME="tex2html77"
+ HREF="install.html#SECTION00090000000000000000">Example process: addvalue</A>
+<LI><A NAME="tex2html78"
+ HREF="install.html#SECTION000100000000000000000">KVP request encoding of addvalue</A>
+<LI><A NAME="tex2html79"
+ HREF="install.html#SECTION000110000000000000000">XML request encoding addvalue</A>
+<LI><A NAME="tex2html80"
+ HREF="install.html#SECTION000120000000000000000">Licence of PyWPS</A>
+<LI><A NAME="tex2html81"
+ HREF="install.html#SECTION000130000000000000000">Licence of this document</A>
</UL>
<!--End of Table of Contents-->
<P>
@@ -177,6 +180,33 @@
<P>
+<H2><A NAME="SECTION00021000000000000000">
+How it works</A>
+</H2>
+PyWPS is an translator application between client (Web Browser, Desktop
+GIS, command line tool, ...) and working tool installed on the server.
+PyWPS does no work by it self. As working tool, GRASS GIS, GDAL, PROJ, R
+and other programs can be used.
+
+<P>
+
+<DIV ALIGN="CENTER"><A NAME="pic:pywps"></A><A NAME="43"></A>
+<TABLE>
+<CAPTION ALIGN="BOTTOM"><STRONG>Figure 1:</STRONG>
+How does PyWPS work: GRASS GIS is in this case working tool</CAPTION>
+<TR><TD>
+<DIV ALIGN="CENTER">
+<IMG
+ WIDTH="827" HEIGHT="273" ALIGN="BOTTOM" BORDER="0"
+ SRC="./pywps-schema.png"
+ ALT="Image pywps-schema">
+
+</DIV></TD></TR>
+</TABLE>
+</DIV>
+
+<P>
+
<H1><A NAME="SECTION00030000000000000000">
Bugs</A>
</H1>
@@ -190,7 +220,11 @@
</UL>
<P>
-Please report all problems or unexpected handeling.
+Please report all problems or unexpected handeling either via pywps mailing
+list<A NAME="tex2html8"
+ HREF="#foot357"><SUP><SPAN CLASS="arabic">1</SPAN></SUP></A>or using PyWPS
+bugtracker<A NAME="tex2html9"
+ HREF="#foot358"><SUP><SPAN CLASS="arabic">2</SPAN></SUP></A>.
<P>
@@ -204,8 +238,6 @@
<P>
<UL>
-<LI>Web Server (e.g. Apache)
-</LI>
<LI>python
</LI>
<LI>python-xml
@@ -218,7 +250,14 @@
<P>
<UL>
-<LI>GIS GRASS - <TT><A NAME="tex2html7"
+<LI>Web Server (e.g. Apache) - <TT><A NAME="tex2html10"
+ HREF="http://httpd.apache.org">http://httpd.apache.org</A></TT> - You
+ will need an web server, to be able to execute processes from remote
+ computers.
+
+<P>
+</LI>
+<LI>GIS GRASS - <TT><A NAME="tex2html11"
HREF="http://grass.itc.it">http://grass.itc.it</A></TT> - Geographical Resources
Analysis Support System (GRASS) is Open Source GIS, which provides more
then 350 modules for raster and vector (2D, 3D) data analysis. PyWPS is
@@ -226,7 +265,7 @@
<P>
</LI>
-<LI>PROJ.4 - <TT><A NAME="tex2html8"
+<LI>PROJ.4 - <TT><A NAME="tex2html12"
HREF="http://proj.maptools.org">http://proj.maptools.org</A></TT> - Cartographic
Projections library used in various Open Source projects, such as
GRASS, UMN MapServer, QGIS and others. It can be used e.g. for data
@@ -234,7 +273,7 @@
<P>
</LI>
-<LI>GDAL/OGR - <TT><A NAME="tex2html9"
+<LI>GDAL/OGR - <TT><A NAME="tex2html13"
HREF="http://gdal.org">http://gdal.org</A></TT> - translator library for
raster geospatial data formats, is used in various projects for
importing, exporting and transformation between various raster and vector
@@ -242,7 +281,7 @@
<P>
</LI>
-<LI>R - <TT><A NAME="tex2html10"
+<LI>R - <TT><A NAME="tex2html14"
HREF="http://www.r-project.org">http://www.r-project.org</A></TT> - is a language and environment
for statistical computing and graphics.
@@ -256,27 +295,34 @@
Installation the quick 'n' dirty way</A>
</H2>
For installing pywps to your server simply unzip the archive to the
-directory, where cgi programs are allowed to run.
+directory, where cgi programs are allowed to run. You can also use current
+repository version.
<P>
+<PRE>
+$ cd /usr/lib/cgi-bin/
+$ tar xvzf /tmp/pywps-VERSION.tar.gz
+$ pywps/wps.py
+</PRE>
+<P>
+
<H2><A NAME="SECTION00042000000000000000">
Installation the 'clean' way</A>
</H2>
Unzip the package
-gray!25
<PRE>
$ tar -xzf pywps-VERSION.tar.gz
</PRE>
and run
<PRE>
$ python setup.py install
-</PRE>
+</PRE>
<P>
Several binary packages for Linux distributios are also avaliable on PyWPS
-site<A NAME="tex2html11"
- HREF="#foot60"><SUP><SPAN CLASS="arabic">1</SPAN></SUP></A>.
+site<A NAME="tex2html15"
+ HREF="#foot75"><SUP><SPAN CLASS="arabic">3</SPAN></SUP></A>.
<P>
@@ -326,7 +372,7 @@
Before you start to tune your pywps program, you should get your copy of
OpenGIS(R) Web Processing Service document (OGC 05-007r4) version 0.4.0
from
-<BR><TT><A NAME="tex2html13"
+<BR><TT><A NAME="tex2html17"
HREF="http://www.opengeospatial.org/specs/?page=specs">http://www.opengeospatial.org/specs/?page=specs</A></TT>
<P>
@@ -344,10 +390,11 @@
any python knowledge.
<P>
-The first file is in <TT>etcsettings.py</TT> and (optional) the second file is
-<TT>etcgrass.py</TT> which has to be setuped if you do want to use
+The first file is in <TT>etc/settings.py</TT> and (optional) the second file is
+<TT>etc/grass.py</TT> which has to be setuped if you do want to use
GRASS GIS modules in your scripts. Some special "tuning" can be done in <TT>processes/__init__.py</TT>
-file
+file. You can allways obtain original configuration files from
+<TT>Wps/default_settings.py</TT> and <TT>Wps/default_grass.py</TT>.
<P>
@@ -365,29 +412,31 @@
<P>
<PRE>
-'version': "0.4.0",
-'ServiceIdentification': {
- 'Title':"Jachym's WPS server",
- 'ServiceType':"WPS",
- 'ServiceTypeVersion':"0.1.0",
- 'Abstract':'Abstract to this WPS',
-},
-'ServiceProvider': {
- 'ProviderName' : "Your Company",
- 'IndividualName':"Your Name",
- 'PositionName':"Your Position",
- 'Role':"your role",
- 'DeliveryPoint': "Street",
- 'City': "City",
- 'PostalCode':"00000",
- 'Country': "Your country",
- 'ElectronicMailAddress':"your.email at address",
-},
+WPS = {
+ 'version': "0.4.0",
+ 'ServiceIdentification': {
+ 'Title':"Jachym's WPS server",
+ 'ServiceType':"WPS",
+ 'ServiceTypeVersion':"0.1.0",
+ 'Abstract':'Abstract to this WPS',
+ },
+ 'ServiceProvider': {
+ 'ProviderName' : "Your Company",
+ 'IndividualName':"Your Name",
+ 'PositionName':"Your Position",
+ 'Role':"your role",
+ 'DeliveryPoint': "Street",
+ 'City': "City",
+ 'PostalCode':"00000",
+ 'Country': "Your country",
+ 'ElectronicMailAddress':"your.email at address",
+ },
-'OperationsMetadata': {
- 'ServerAddress' : "http://localhost/cgi-bin/wps/wps.py",
-},
-'Keywords' : ['GRASS','GIS','WPS'],
+ 'OperationsMetadata': {
+ 'ServerAddress' : "http://localhost/cgi-bin/wps/wps.py",
+ },
+ 'Keywords' : ['GRASS','GIS','WPS'],
+}
</PRE>
<P>
@@ -396,36 +445,38 @@
<P>
<PRE>
-# NOTE: You have to create this directory manually and set rights, so
-# the program is able to store data in there
-'outputPath': '/var/www/wpsoutputs',
-
-#
-# 'outputUrl' - URL of the directory, where the outputs will be stored
-'outputUrl': 'http://192.168.1.31/wpsoutputs',
-
-#
-# tempPath - path to directory, where temporary data will be stored.
-# NOTE: the pywps has to have rights, to create directories and files
-# in this directory
-'tempPath': '/tmp',
-
-#
-# maxOperations - maximum number of operations, which is allowed to low
-# on this server at ones
-# default = 1
-'maxOperations':1,
-
-#
-# maxSize: maximum input file size in bytes
-# NOTE: maximum file size is 5MB, no care, if this number is higher
-'maxSize':5242880, # 5 MB
-
-#
-# maxInputParamLength: maximal length of input values
-# NOTE: maximum length of input parameters is 256, no matter, how height
-# is this number
-'maxInputParamLength':256,
+ServerSettings = {
+ # NOTE: You have to create this directory manually and set rights, so
+ # the program is able to store data in there
+ 'outputPath': '/var/www/wpsoutputs',
+
+ #
+ # 'outputUrl' - URL of the directory, where the outputs will be stored
+ 'outputUrl': 'http://192.168.1.31/wpsoutputs',
+
+ #
+ # tempPath - path to directory, where temporary data will be stored.
+ # NOTE: the pywps has to have rights, to create directories and files
+ # in this directory
+ 'tempPath': '/tmp',
+
+ #
+ # maxOperations - maximum number of operations, which is allowed to low
+ # on this server at ones
+ # default = 1
+ 'maxOperations':1,
+
+ #
+ # maxSize: maximum input file size in bytes
+ # NOTE: maximum file size is 5MB, no care, if this number is higher
+ 'maxSize':5242880, # 5 MB
+
+ #
+ # maxInputParamLength: maximal length of input values
+ # NOTE: maximum length of input parameters is 256, no matter, how height
+ # is this number
+ 'maxInputParamLength':256,
+}
</PRE>
<P>
@@ -440,31 +491,33 @@
<P>
<PRE>
-# PATH in which your modules (processes) should be able the search.
-# Default value:
-'PATH': "/usr/local/grass-6.1.cvs/bin/:/usr/local/grass-6.1.cvs/scripts/:\
-/usr/bin/:/bin/:",
-
-# Add eventually some other path, in which should GRASS search for modules
-'GRASS_ADDON_PATH': "",
-
-# Version of GRASS, you are using
-'GRASS_VERSION': "6.1.cvs",
-
-# GRASS_PERL, where is your PERL bin installed
-'GRASS_PERL': "/usr/bin/perl",
-
-# GRASS_GUI should be always "text" unless you know, what you are doing
-'GRASS_GUI': "text",
-
-# GISBASE is place, where your GRASS installation is
-'GISBASE': "/usr/local/grass-6.1.cvs",
-
-# LD_LIBRARY_PATH
-'LD_LIBRARY_PATH':"/usr/local/grass-6.1.cvs/lib",
-
-# HOME has to be set
-'HOME':"/var/www",
+grassenv = {
+ # PATH in which your modules (processes) should be able the search.
+ # Default value:
+ 'PATH': "/usr/local/grass-6.1.cvs/bin/:/usr/local/grass-6.1.cvs/scripts/:\
+ /usr/bin/:/bin/:",
+
+ # Add eventually some other path, in which should GRASS search for modules
+ 'GRASS_ADDON_PATH': "",
+
+ # Version of GRASS, you are using
+ 'GRASS_VERSION': "6.1.cvs",
+
+ # GRASS_PERL, where is your PERL bin installed
+ 'GRASS_PERL': "/usr/bin/perl",
+
+ # GRASS_GUI should be always "text" unless you know, what you are doing
+ 'GRASS_GUI': "text",
+
+ # GISBASE is place, where your GRASS installation is
+ 'GISBASE': "/usr/local/grass-6.1.cvs",
+
+ # LD_LIBRARY_PATH
+ 'LD_LIBRARY_PATH':"/usr/local/grass-6.1.cvs/lib",
+
+ # HOME has to be set
+ 'HOME':"/var/www",
+}
</PRE>
<P>
@@ -482,7 +535,7 @@
<P>
-All processes are stored in the processes directory. Put your file
+All processes are stored in the <TT>processes</TT> directory. Put your file
e.g. <TT>myprocess.py</TT> in there. Several example processes are
distributed along with PyWPS source code.
@@ -509,58 +562,36 @@
04 class Process(WPSProcess):
05 def __init__(self):
06 WPSProcess.__init__(self,
-07 Identifier="spearpath",
-18 Title="Spearfish path searching",
-19 Abstract="Find the shortest path on the roads map on Spearfish dataset",
+07 Identifier="ogr2ogr",
+18 Title="ogr2ogr interface",
+19 Abstract="Convert vector file to another format",
10 processVersion = "0.2",
11 statusSupported="true",
12 storeSupported="true")
</PRE>
<P>
-We defined new process called <TT>spearpath</TT>. The process is allowed to
+We defined new process called <TT>ogr2ogr</TT>. The process is allowed to
store it's output data on the server (<TT>storeSupported</TT>) and it is also possible to run it in
asynchronous mode (<TT>statusSupported</TT>).
<P>
Eventually optional attributes can be found in the table 38 - "Parts of
-ExecuteResponse data structure". It is also possible to redefine some
+ExecuteResponse data structure" in the WPS reference
+document<A NAME="tex2html18"
+ HREF="#foot361"><SUP><SPAN CLASS="arabic">4</SPAN></SUP></A>. It is also possible to redefine some
variable later, after initialization:
<P>
<PRE>
13
-14 self.Title="South Dacota path searching"
+14 self.Title="ogr2ogr interface"
15
</PRE>
<P>
-<H2><A NAME="SECTION00062000000000000000">
-Running in GRASS session</A>
-</H2>
-You have to define GRASS Locatio<A NAME="tex2html14"
- HREF="#foot305"><SUP><SPAN CLASS="arabic">2</SPAN></SUP></A>
-If your process should happen in existing GRASS-Location, and you just need
-the input parameters for GRASS modules, you can specify it's name by
-<TT>grassLocation</TT> variable.
-
-<P>
-<PRE>
-16 # use existing GRASS Location
-17 self.grassLocation="/var/grassdata/spearfish60/"
-18 # use temporary GRASS Location
-19 #self.grassLocation=None
-</PRE>
-
-<P>
-If this variable is set to <TT>None</TT>, new temporary GRASS Location && mapset will be
-generated (using XY coordinate system) and you can work in there. The projection of the location will be
-XY. If this variable is not set, GRASS will not be stared.
-
-<P>
-
-<H4><A NAME="SECTION00062010000000000000">
+<H4><A NAME="SECTION00061010000000000000">
Metadata defition</A>
</H4> is stored in array <TT>self.Metadata</TT> in
<TT>__init__</TT> method. You can add new Medatada using
@@ -583,7 +614,7 @@
<P>
-<H3><A NAME="SECTION00062100000000000000">
+<H3><A NAME="SECTION00061100000000000000">
Data Inputs</A>
</H3>
Data inputs are stored in <TT>self.Inputs</TT> array. To add inputs to
@@ -592,9 +623,29 @@
<P>
Four types of data inputs are defined:
+<UL>
+<LI>Literal Input - Basic literal input - single number or text
+ value
+</LI>
+<LI>ComplexValue Input - Mostly vector file embded in input XML
+ request
+</LI>
+<LI>ComplexValueReference Input - URL to location, where the process
+ is supposed to get the input data.
+</LI>
+<LI>BoundingBox Input - Coordinates for lower-left and upper-right
+ corner.
+</LI>
+</UL>
+
<P>
+ComplexValue and ComplexValueReference defined on the same way - PyWPS is
+able to guess, if the input data are reference (link) to some map or raw
+data directly.
-<H4><A NAME="SECTION00062110000000000000">
+<P>
+
+<H4><A NAME="SECTION00061110000000000000">
LiteralInput</A>
</H4>
@@ -617,7 +668,7 @@
<P>
-<H5><A NAME="SECTION00062111000000000000">
+<H5><A NAME="SECTION00061111000000000000">
Example of any allowed input value (default)</A>
</H5>
<PRE>
@@ -643,7 +694,7 @@
<P>
-<H5><A NAME="SECTION00062112000000000000">
+<H5><A NAME="SECTION00061112000000000000">
Example of specified list (with range) of allowed inputs</A>
</H5>
@@ -681,20 +732,80 @@
<P>
For further documentation, refere example processes distributed with the
-source code as well as <TT>pydoc pywps/wps/process.py</TT>.
+source code as well as <TT>pydoc pywps/wps/process.py</TT>. This help is
+also available in
+<TT>process.html</TT><A NAME="tex2html20"
+ HREF="#foot362"><SUP><SPAN CLASS="arabic">5</SPAN></SUP></A> file distributed along with PyWPS
+source code.
<P>
-<H3><A NAME="SECTION00062200000000000000">
+<H4><A NAME="SECTION00061120000000000000">
+ComplexInput</A>
+</H4>
+If the request comes as HTTP GET, it is assumed, that the input is only
+reference to some map. If it comes as HTTP POST, PyWPS tryes to guess, if
+the client is sending URL to source of the data or if the input data are
+part of input XML request (e.g. as GML file). So, you, as a process coder
+do not have to take care on this:
+
+<P>
+<PRE>
+self.AddComplexInput(Indentifier="inputmap",
+ Title="Input map, which should be processed",
+ Formats=["text/xml","image/tiff"])
+...
+ <Input>
+ <ows:Identifier>input</ows:Identifier>
+ <ows:Title>Input raster map</ows:Title>
+ <ows:Abstract/>
+ <ComplexData defaultFormat="image/tiff">
+ <SupportedComplexData>
+ <Format>image/tiff</Format>
+ <Format>text/xml</Format>
+ </SupportedComplexData>
+ </ComplexData>
+ <MinimumOccurs>1</MinimumOccurs>
+ </Input>
+</PRE>
+
+<P>
+
+<H4><A NAME="SECTION00061130000000000000">
+BoundingBox Input</A>
+</H4>
+With bounding box, you can define two coordinate pairs, if you have to.
+
+<P>
+<PRE>
+self.AddBondingBoxInput(Identifier="bbox",
+ Title="BBox input")
+</PRE>
+
+<P>
+
+<H3><A NAME="SECTION00061200000000000000">
Data Outputs</A>
</H3>
+Again four types of output are defined:
+<UL>
+<LI>Literal Output
+</LI>
+<LI>ComplexValue Output
+</LI>
+<LI>ComplexValue Reference
+</LI>
+<LI>BoundingBox Output
+</LI>
+</UL>
+
<P>
Data outputs can be defined on similar way, using similar methods:
<P>
-<H4><A NAME="SECTION00062210000000000000">
+<H4><A NAME="SECTION00061210000000000000">
LiteralOutput</A>
</H4>
<PRE>
@@ -716,6 +827,10 @@
</PRE>
<P>
+
+<H4><A NAME="SECTION00061220000000000000">
+ComplexValue and ComplexValueReference Output</A>
+</H4>
To the oposite of data Inputs, Outputs can distinguish between ComplexValue
output and ComplexValueReference. ComplexValue is directly embed into the
output XML document and ComplexValueReference is stored on the server and
@@ -725,7 +840,7 @@
<P>
<PRE>
-self.AddComplexValueReferenceOutput(Identifier="output",
+self.AddComplexReferenceOutput(Identifier="output",
Title="Resulting output map",
Formats=["image/tiff"])
@@ -744,9 +859,13 @@
</PRE>
<P>
-Beside LiteralValue and ComplexValue, BoundingBoxValue is also defined. The
-coordinates are stored in array of four members:
+<H4><A NAME="SECTION00061230000000000000">
+BoundingBox Output</A>
+</H4>
+Beside LiteralValue and ComplexValue, BoundingBoxValue is also defined.
+The coordinates are stored in array of four members:
+
<P>
<PRE>
self.GetInputValue("bboxinput")
@@ -755,7 +874,46 @@
<P>
-<H2><A NAME="SECTION00063000000000000000">
+<P><P>
+<BR>
+
+<P>
+So on our <TT>ogr2ogr</TT> process, we have to define three types of input:
+<TT>ComplexValue</TT> of input vector file and EPSG codes of target and
+source files:
+
+<P>
+<PRE>
+16 self.AddComplexInput(Identifier="inputmap",
+17 Title ="Input vector file",
+18 Abstract = "Input vector file to be converted",
+19 Formats=["text/xml"])
+20
+21 self.AddLiteralInput(Identifier="sepsg",
+22 Title="Source EPSG",
+23 Abstract="Source EPSG code",
+24 value=4326)
+</PRE>
+
+<P>
+And we also define two outputs: ComplexValueReference and ComplexValue
+type.
+
+<P>
+<PRE>
+25 self.AddComplexOutput(Identifier="outputmap",
+26 Title ="Input vector file",
+27 Abstract = "Input vector file to be converted",
+28
+29 self.LiteralOutput(Identifier="sepsg",
+30 Title="Source EPSG",
+31 Abstract="Source EPSG code",
+32 value=4326)
+</PRE>
+
+<P>
+
+<H2><A NAME="SECTION00062000000000000000">
Process Programming</A>
</H2>
@@ -796,27 +954,32 @@
<P>
+If you need to execute some shell command, you should use
+<TT>self.Cmd(command,["string for standard input"])</TT> instead of e.g.
+<TT>os.system()</TT> or <TT>os.popen()</TT> functions.
+
+<P>
<PRE>
-22 def execute(self):
-23 if os.system("""g.region -d >&2"""):
-24 return "Could not set region to default"
-25
-26 os.system("r.in.gdal -o in=%s out=my_map >&2" %\
-27 (self.Inputs[0]['value']))
-28 os.system("r.mapcalc my_output=my_map+%d >&2" %\
-29 (self.DataInputs['value']))
-31
-32 if os.system("r.out.gdal type=Float32 out=map.tif in=my_output >&2"):
-33 return "Could not export resulting raster map [map.tif]"
-34
-35 self.Outputs[0]['value'] = "map.tif"
-36 self.DataOutputs['location'] = self.grassenv['LOCATION_NAME']
-37 return
+33
+35 def execute(self):
+36
+37 #
+38 # calculation
+39 #
+30 self.Cmd("""ogr2ogr -s_srs "+init=epsg:4326" -t_srs \
+31 "+init=epsg:2065" %s output.file""" % (self.GetInputValue("inputmap")))
+32 #
+43 # setting results
+44 #
+45 self.SetOutputValue("outputmap","output.file")
+46 self.SetOutputValue("sepsg","4326")
+47
+48 return
</PRE>
<P>
-<H3><A NAME="SECTION00063100000000000000">
+<H3><A NAME="SECTION00062100000000000000">
Error handling</A>
</H3>
@@ -826,19 +989,106 @@
<P>
-<H1><A NAME="SECTION00070000000000000000">
-Note to grass programming</A>
-</H1>
+<H3><A NAME="SECTION00062200000000000000">
+Using standard in- and output with external commands</A>
+</H3>
+The <TT>self.Cmd()</TT> accepts <TT>input</TT> parameter, wich is a text
+string, which is directred to standard input of the command:
<P>
-<TT>WMSProcess</TT> class provides special method
-<TT>self.Gcmd(command_string)</TT>, which tryes to catch output from GRASS
+<PRE>
+ result = self.Cmd(cmd="wc -c",
+ input="calculate number of characters for this sentence")
+
+ # result[0].split()
+</PRE>
+
+<P>
+<TT>self.Cmd()</TT> returns list of lines from the programms standard
+output to the process:
+
+<P>
+<PRE>
+ for line in self.Cmd("ls -l"):
+ # do some operations of list of files
+ pass
+</PRE>
+
+<P>
+
+<H2><A NAME="SECTION00063000000000000000">
+GRASS specific notes</A>
+</H2>
+
+<P>
+Special class for GRASS GIS is defined too, which has functions and
+variables specific to this program. The process, in which should use GRASS
+modules should be defined as follows:
+
+<P>
+<PRE>
+# importing necessary files
+import pywps.Wps.GRASSWPSProcess
+
+class Process(GRASSWPSProcess):
+ def __init__(self):
+ GRASSWPSProcess.__init__(self,
+ Identifier="spearpath",
+ Title="Spearfish path searching",
+ Abstract="Find the shortest path on the roads map on Spearfish dataset",
+ processVersion = "0.2",
+ statusSupported="true",
+ storeSupported="true",
+ # grassLocation="/var/www/spearfish60/" # work on existing location)
+</PRE>
+
+<P>
+By default, <TT>self.grassLocation</TT><A NAME="tex2html21"
+ HREF="#foot365"><SUP><SPAN CLASS="arabic">6</SPAN></SUP></A>
+ variable is set to <TT>None</TT>,
+which means, that temporary location will be created and after the
+calculation is done, it will be deleted again. You can set this while
+process initialization or
+later<A NAME="tex2html22"
+ HREF="#foot366"><SUP><SPAN CLASS="arabic">7</SPAN></SUP></A>.
+
+<P>
+<TT>WPSProcess</TT> class provides special method
+<TT>self.GCmd(command_string)</TT>, which tryes to catch output from GRASS
modules, especially progress information inidcated by percent done. Method
-<TT>Gcmd()</TT> stores the output of GRASS modules to <TT>self.status</TT>
+<TT>GCmd()</TT> stores the output of GRASS modules to <TT>self.status</TT>
variable, so if the process is running assynchronously, client application
can track the progress of each module directly.
<P>
+<PRE>
+ def execute(self):
+ """
+ This function serves like simple GRASS - python script
+
+ It returns None, if process succeed or String if process failed
+ """
+ self.GCmd("g.region -d")
+
+
+ # v.net.path reads from standard input
+ self.GCmd("v.net.path in=roads out=path","0 %s %s %s %s" % (self.GetInputValue('x1'),
+ self.GetInputValue('y1'),
+ self.GetInputValue('x2'),
+ self.GetInputValue('y2')))
+
+ self.GCmd("v.out.ogr format=GML input=path dsn=out.xml olayer=path.xml")
+
+ if "out.xml" in os.listdir(os.curdir):
+ shutil.copy("out.xml","out2.xml")
+ self.SetOutputValue('outputReference',"out.xml")
+ self.SetOutputValue('outputData',"out2.xml")
+ return
+ else:
+ return "Ouput file not created!"
+</PRE>
+
+<P>
It is also possible to run GRASS modules using python's
<TT>os.system()</TT> or <TT>os.popen()</TT> function. Before you do so, it
is important to import the <TT>os</TT> python package (usually one of the
@@ -863,11 +1113,11 @@
</PRE>
<P>
-You can avoid this problem using formentioned <TT>self.Gcmd()</TT> method.
+You can avoid this problem using formentioned <TT>self.GCmd()</TT> method.
<P>
-<H1><A NAME="SECTION00080000000000000000">
+<H1><A NAME="SECTION00070000000000000000">
Testing your new process</A>
</H1>
@@ -920,11 +1170,11 @@
<P>
-<H1><A NAME="SECTION00090000000000000000">
+<H1><A NAME="SECTION00080000000000000000">
Using PyWPS</A>
</H1>
-<H2><A NAME="SECTION00091000000000000000">
+<H2><A NAME="SECTION00081000000000000000">
Input</A>
</H2>
@@ -954,7 +1204,7 @@
<P>
The <TT>execute-post.txt</TT> file can look like follows:
<PRE>
-request=<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Execute service="WPS" version="0.4.0" store="false" status="false"
xmlns="http://www.opengeospatial.net/wps"
xmlns:ows="http://www.opengeospatial.net/ows"
@@ -1043,7 +1293,7 @@
</LI>
</OL>
-<H2><A NAME="SECTION00092000000000000000">
+<H2><A NAME="SECTION00082000000000000000">
Output</A>
</H2>
@@ -1089,9 +1339,17 @@
self.status = ["Message", Percent_Done]
</PRE>
and generate XML file in statusLocation with this embed message. E.g.
+
+<P>
<PRE>
self.status = ["Generating raster map", 50]
</PRE>
+or better
+<PRE>
+ self.SetStatus("Generarting raster map", 50_Done)
+</PRE>
+
+<P>
will become
<P>
@@ -1104,15 +1362,11 @@
</PRE>
<P>
-You can set also <TT>self.status</TT> variable using
-<TT>self.SetStatus()</TT> method.
<P>
-<P>
-
-<H1><A NAME="SECTION000100000000000000000">
-Sample process: <TT>addvalue</TT></A>
+<H1><A NAME="SECTION00090000000000000000">
+Example process: <TT>addvalue</TT></A>
</H1>
This sample process describes how to made your own WPS processes. Purpose of this process is:
@@ -1143,22 +1397,21 @@
# Copyright (C) 2006 Jachym Cepicky
import os,time,string,sys,shutil
-from pywps.Wps.process import WPSProcess
+from pywps.Wps.process import GRASSWPSProcess
-class Process (WPSProcess):
+class Process (GRASSWPSProcess):
#
# Initialization
#
def __init__(self):
- WPSProcess.__init__(self,
+ GRASSWPSProcess.__init__(self,
Identifier="Addvalue",
Title="Add some value to input raster map",
processVersion = "0.2",
statusSupported="true",
- storeSupported="true")
+ storeSupported="true",
+ grassLocation = None)
- # define GRASS location -- use temporary one
- self.grassLocation = None
#
# Inputs
@@ -1171,7 +1424,7 @@
#
# Outputs
- self.AddComplexValueReferenceOutput(Identifier="output",
+ self.AddComplexReferenceOutput(Identifier="output",
Title="Resulting output map",
Formats=["image/tiff"])
#
@@ -1188,7 +1441,7 @@
# import of the data
self.SetStatus("Importing data")
- if not self.Gcmd("r.in.gdal -o in=%s out=input" %\
+ if not self.GCmd("r.in.gdal -o in=%s out=input" %\
(self.GetInputValue("input"))):
return "Could not import raster file"
self.SetStatus("Importing data",10)
@@ -1197,19 +1450,19 @@
for gdalinfoln in os.popen("gdalinfo %s" %\
(self.GetInputValue("input"))):
if gdalinfoln.split()[0] == "Band" and gdalinfoln.split()[1] == "3":
- self.Gcmd("""g.region rast=input.red """)
- self.Gcmd("r.composite r=input.red b=input.blue g=input.green out=input")
+ self.GCmd("""g.region rast=input.red """)
+ self.GCmd("r.composite r=input.red b=input.blue g=input.green out=input")
# region setting
- self.Gcmd("""g.region rast=input""")
+ self.GCmd("""g.region rast=input""")
# adding the value
self.SetStatus("Adding new value to raster map",50)
- self.Gcmd("r.mapcalc output='input+%f'" % float(self.GetInputValue('value')))
+ self.GCmd("r.mapcalc output='input+%f'" % float(self.GetInputValue('value')))
# output
self.SetStatus("Raster file export", 90)
- self.Gcmd("r.out.gdal type=Int32 in=output out=%s" % "output.tif")
+ self.GCmd("r.out.gdal type=Int32 in=output out=%s" % "output.tif")
# setting output values
self.SetOutputValue("output","output.tif")
@@ -1222,7 +1475,7 @@
<P>
-<H1><A NAME="SECTION000110000000000000000">
+<H1><A NAME="SECTION000100000000000000000">
KVP request encoding of <TT>addvalue</TT></A>
</H1>
This process can be lunched with URL:
@@ -1236,7 +1489,7 @@
<P>
-<H1><A NAME="SECTION000120000000000000000">
+<H1><A NAME="SECTION000110000000000000000">
XML request encoding <TT>addvalue</TT></A>
</H1>
<PRE>
@@ -1271,7 +1524,7 @@
<P>
-<H1><A NAME="SECTION000130000000000000000">
+<H1><A NAME="SECTION000120000000000000000">
Licence of PyWPS</A>
</H1>
@@ -1678,7 +1931,7 @@
<P>
-<H1><A NAME="SECTION000140000000000000000">
+<H1><A NAME="SECTION000130000000000000000">
Licence of this document</A>
</H1>
@@ -2205,7 +2458,7 @@
<P>
-<H1><A NAME="SECTION000150000000000000000">
+<H1><A NAME="SECTION000140000000000000000">
About this document ...</A>
</H1>
<STRONG>Implementation of OGC's WPS standard: PyWPS</STRONG><P>
@@ -2213,7 +2466,7 @@
<A HREF="http://www.latex2html.org/"><STRONG>LaTeX</STRONG>2<tt>HTML</tt></A> translator Version 2002-2-1 (1.71)
<P>
Copyright © 1993, 1994, 1995, 1996,
-<A HREF="http://cbl.leeds.ac.uk/nikos/personal.html">Nikos Drakos</A>,
+Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
<BR>
Copyright © 1997, 1998, 1999,
@@ -2223,23 +2476,56 @@
The command line arguments were: <BR>
<STRONG>latex2html</STRONG> <TT>-split 0 install.tex</TT>
<P>
-The translation was initiated by Jachym Cepicky on 2007-03-15
+The translation was initiated by Jachym Cepicky on 2007-06-12
<BR><HR><H4>Footnotes</H4>
<DL>
-<DT><A NAME="foot60">...
+<DT><A NAME="foot357">...
+list</A><A
+ HREF="install.html#tex2html8"><SUP><SPAN CLASS="arabic">1</SPAN></SUP></A></DT>
+<DD>http://wald.intevation.org/mailman/listinfo/pywps-develPyWPS
+- development list
+
+</DD>
+<DT><A NAME="foot358">...
+bugtracker</A><A
+ HREF="install.html#tex2html9"><SUP><SPAN CLASS="arabic">2</SPAN></SUP></A></DT>
+<DD>http://wald.intevation.org/tracker/?atid=174&group_id=22&func=browsePyWPS
+Bug tracker
+
+</DD>
+<DT><A NAME="foot75">...
site</A><A
- HREF="install.html#tex2html11"><SUP><SPAN CLASS="arabic">1</SPAN></SUP></A></DT>
-<DD><TT><A NAME="tex2html12"
+ HREF="install.html#tex2html15"><SUP><SPAN CLASS="arabic">3</SPAN></SUP></A></DT>
+<DD><TT><A NAME="tex2html16"
HREF="http://pywps.wald.intevation.org">http://pywps.wald.intevation.org</A></TT>
</DD>
-<DT><A NAME="foot305">... Locatio</A><A
- HREF="install.html#tex2html14"><SUP><SPAN CLASS="arabic">2</SPAN></SUP></A></DT>
-<DD>see e.g.
-<TT><A NAME="tex2html15"
- HREF="http://grass.itc.it/grass63/manuals/html63_user/helptext.html">http://grass.itc.it/grass63/manuals/html63_user/helptext.html</A></TT> for details
+<DT><A NAME="foot361">...
+document</A><A
+ HREF="install.html#tex2html18"><SUP><SPAN CLASS="arabic">4</SPAN></SUP></A></DT>
+<DD><TT><A NAME="tex2html19"
+ HREF="http://www.opengeospatial.org/standards/requests/28">http://www.opengeospatial.org/standards/requests/28</A></TT>
</DD>
+<DT><A NAME="foot362">...process.html</A><A
+ HREF="install.html#tex2html20"><SUP><SPAN CLASS="arabic">5</SPAN></SUP></A></DT>
+<DD>http://wald.intevation.org/plugins/scmsvn/viewcvs.php/*checkout*/trunk/doc/process.html?rev=369&root=pywpsDocumentation
+to process.py module
+
+</DD>
+<DT><A NAME="foot365">...self.grassLocation</A><A
+ HREF="install.html#tex2html21"><SUP><SPAN CLASS="arabic">6</SPAN></SUP></A></DT>
+<DD>See e.g.
+http://grass.itc.it/grass63/manuals/html63_user/helptext.htmlGRASS
+manual for details
+
+</DD>
+<DT><A NAME="foot366">...
+later</A><A
+ HREF="install.html#tex2html22"><SUP><SPAN CLASS="arabic">7</SPAN></SUP></A></DT>
+<DD><TT>self.grassLocation="/path/to/location"</TT>
+
+</DD>
</DL>
<DIV CLASS="navigation"><HR>
<!--Navigation Panel-->
@@ -2253,7 +2539,7 @@
<!--End of Navigation Panel-->
<ADDRESS>
Jachym Cepicky
-2007-03-15
+2007-06-12
</ADDRESS>
</BODY>
</HTML>
Modified: trunk/doc/install.pdf
===================================================================
(Binary files differ)
Modified: trunk/doc/install.tex
===================================================================
--- trunk/doc/install.tex 2007-06-10 10:42:44 UTC (rev 371)
+++ trunk/doc/install.tex 2007-06-12 08:34:48 UTC (rev 372)
@@ -3,7 +3,9 @@
\usepackage{lscape}
\usepackage[utf8]{inputenc}
\usepackage{a4wide}
-\usepackage[pdftitle={PyWPS Manual},colorlinks=true,bookmarks,dvips]{hyperref}
+\usepackage[dvips]{graphicx}
+\usepackage{url}
+\usepackage[colorlinks=true]{hyperref}
\usepackage[table,dvipsnames]{xcolor}[2004/07/04]
\author{Jachym Cepicky}
@@ -19,7 +21,7 @@
\newcommand{\pywpssite}{\url{http://pywps.wald.intevation.org}}
\newcommand{\pywpswiki}{\url{http://pywps.ominiverdi.org}}
\newcommand{\note}[1]{\medskip{}\noindent{}NOTE: #1\medskip{}}
-\newcommand{\version}{\emph{SVN}}
+\newcommand{\version}{\emph{2.0.0}}
\makeatother
@@ -49,7 +51,7 @@
PyPWS project has been started on April 2006 with support of DBU --
Deutsche Bundesstiftung Umwelt (\url{http://dbu.de}) and with help of
GDF-Hannover (\url{http://gdf-hannover.de}) and Help Service Remote
-Sensing (\url{http:/bnhelp.cz}) companies. Initial author is Jachym
+Sensing (\url{http://www.bnhelp.cz}) companies. Initial author is Jachym
Cepicky (\url{http://les-ejk.cz}).
@@ -76,6 +78,20 @@
PyWPS Homepage can be found at \pywpssite.
PyWPS Wiki is hosted on \pywpswiki.
+
+\subsection{How it works}
+PyWPS is an translator application between client (Web Browser, Desktop
+GIS, command line tool, \dots) and working tool installed on the server.
+PyWPS does no work by it self. As working tool, GRASS GIS, GDAL, PROJ, R
+and other programs can be used.
+
+\begin{figure}[ht]
+\begin{center}
+\includegraphics[width=1\textwidth]{pic/pywps-schema}
+\caption{How does PyWPS work: GRASS GIS is in this case working tool}
+\label{pic:pywps}
+\end{center}
+\end{figure}
%---------------------------------------------------------------------
\section{Bugs}
@@ -87,7 +103,12 @@
not use it directly in scripts to avoid your server to be hacked.
\end{itemize}
-Please report all problems or unexpected handeling.
+Please report all problems or unexpected handeling either via pywps mailing
+list\footnote{\href{http://wald.intevation.org/mailman/listinfo/pywps-devel}{PyWPS
+- development list}}
+or using PyWPS
+bugtracker\footnote{\href{http://wald.intevation.org/tracker/?atid=174&group\_id=22&func=browse}{PyWPS
+Bug tracker}}.
%---------------------------------------------------------------------
\section{Installation}
@@ -95,7 +116,6 @@
Required packages:
\begin{itemize}
- \item Web Server (e.g. Apache)
\item python
\item python-xml
\end{itemize}
@@ -103,6 +123,10 @@
Recommended packages:
\begin{itemize}
+ \item Web Server (e.g. Apache) -- \url{http://httpd.apache.org} - You
+ will need an web server, to be able to execute processes from remote
+ computers.
+
\item GIS GRASS -- \url{http://grass.itc.it} - Geographical Resources
Analysis Support System (GRASS) is Open Source GIS, which provides more
then 350 modules for raster and vector (2D, 3D) data analysis. PyWPS is
@@ -125,18 +149,24 @@
\subsection{Installation the quick 'n' dirty way}
For installing pywps to your server simply unzip the archive to the
-directory, where cgi programs are allowed to run.
+directory, where cgi programs are allowed to run. You can also use current
+repository version.
+\begin{verbatim}
+$ cd /usr/lib/cgi-bin/
+$ tar xvzf /tmp/pywps-VERSION.tar.gz
+$ pywps/wps.py
+\end{verbatim}
+
\subsection{Installation the 'clean' way}
Unzip the package
-\color{gray!25}
\begin{verbatim}
$ tar -xzf pywps-VERSION.tar.gz
\end{verbatim}
and run
\begin{verbatim}
$ python setup.py install
-\end{verbatim}
+\end{verbatim}
Several binary packages for Linux distributios are also avaliable on PyWPS
site\footnote{\pywpssite}.
@@ -191,10 +221,11 @@
programming language. But you should be able to setup the program without
any python knowledge.
-The first file is in \texttt{etc\/settings.py} and (optional) the second file is
-\texttt{etc\/grass.py} which has to be setuped if you do want to use
+The first file is in \texttt{etc/settings.py} and (optional) the second file is
+\texttt{etc/grass.py} which has to be setuped if you do want to use
GRASS GIS modules in your scripts. Some special "tuning" can be done in \texttt{processes/\_\_init\_\_.py}
-file
+file. You can allways obtain original configuration files from
+\texttt{Wps/default\_settings.py} and \texttt{Wps/default\_grass.py}.
\subsection{\texttt{etc/settings.py}}
@@ -206,29 +237,31 @@
\begin{verbatim}
-'version': "0.4.0",
-'ServiceIdentification': {
- 'Title':"Jachym's WPS server",
- 'ServiceType':"WPS",
- 'ServiceTypeVersion':"0.1.0",
- 'Abstract':'Abstract to this WPS',
-},
-'ServiceProvider': {
- 'ProviderName' : "Your Company",
- 'IndividualName':"Your Name",
- 'PositionName':"Your Position",
- 'Role':"your role",
- 'DeliveryPoint': "Street",
- 'City': "City",
- 'PostalCode':"00000",
- 'Country': "Your country",
- 'ElectronicMailAddress':"your.email at address",
-},
+WPS = {
+ 'version': "0.4.0",
+ 'ServiceIdentification': {
+ 'Title':"Jachym's WPS server",
+ 'ServiceType':"WPS",
+ 'ServiceTypeVersion':"0.1.0",
+ 'Abstract':'Abstract to this WPS',
+ },
+ 'ServiceProvider': {
+ 'ProviderName' : "Your Company",
+ 'IndividualName':"Your Name",
+ 'PositionName':"Your Position",
+ 'Role':"your role",
+ 'DeliveryPoint': "Street",
+ 'City': "City",
+ 'PostalCode':"00000",
+ 'Country': "Your country",
+ 'ElectronicMailAddress':"your.email at address",
+ },
-'OperationsMetadata': {
- 'ServerAddress' : "http://localhost/cgi-bin/wps/wps.py",
-},
-'Keywords' : ['GRASS','GIS','WPS'],
+ 'OperationsMetadata': {
+ 'ServerAddress' : "http://localhost/cgi-bin/wps/wps.py",
+ },
+ 'Keywords' : ['GRASS','GIS','WPS'],
+}
\end{verbatim}
@@ -237,36 +270,38 @@
\begin{verbatim}
-# NOTE: You have to create this directory manually and set rights, so
-# the program is able to store data in there
-'outputPath': '/var/www/wpsoutputs',
-
-#
-# 'outputUrl' - URL of the directory, where the outputs will be stored
-'outputUrl': 'http://192.168.1.31/wpsoutputs',
-
-#
-# tempPath - path to directory, where temporary data will be stored.
-# NOTE: the pywps has to have rights, to create directories and files
-# in this directory
-'tempPath': '/tmp',
-
-#
-# maxOperations - maximum number of operations, which is allowed to low
-# on this server at ones
-# default = 1
-'maxOperations':1,
-
-#
-# maxSize: maximum input file size in bytes
-# NOTE: maximum file size is 5MB, no care, if this number is higher
-'maxSize':5242880, # 5 MB
-
-#
-# maxInputParamLength: maximal length of input values
-# NOTE: maximum length of input parameters is 256, no matter, how height
-# is this number
-'maxInputParamLength':256,
+ServerSettings = {
+ # NOTE: You have to create this directory manually and set rights, so
+ # the program is able to store data in there
+ 'outputPath': '/var/www/wpsoutputs',
+
+ #
+ # 'outputUrl' - URL of the directory, where the outputs will be stored
+ 'outputUrl': 'http://192.168.1.31/wpsoutputs',
+
+ #
+ # tempPath - path to directory, where temporary data will be stored.
+ # NOTE: the pywps has to have rights, to create directories and files
+ # in this directory
+ 'tempPath': '/tmp',
+
+ #
+ # maxOperations - maximum number of operations, which is allowed to low
+ # on this server at ones
+ # default = 1
+ 'maxOperations':1,
+
+ #
+ # maxSize: maximum input file size in bytes
+ # NOTE: maximum file size is 5MB, no care, if this number is higher
+ 'maxSize':5242880, # 5 MB
+
+ #
+ # maxInputParamLength: maximal length of input values
+ # NOTE: maximum length of input parameters is 256, no matter, how height
+ # is this number
+ 'maxInputParamLength':256,
+}
\end{verbatim}
@@ -277,31 +312,33 @@
\begin{verbatim}
-# PATH in which your modules (processes) should be able the search.
-# Default value:
-'PATH': "/usr/local/grass-6.1.cvs/bin/:/usr/local/grass-6.1.cvs/scripts/:\
-/usr/bin/:/bin/:",
-
-# Add eventually some other path, in which should GRASS search for modules
-'GRASS_ADDON_PATH': "",
-
-# Version of GRASS, you are using
-'GRASS_VERSION': "6.1.cvs",
-
-# GRASS_PERL, where is your PERL bin installed
-'GRASS_PERL': "/usr/bin/perl",
-
-# GRASS_GUI should be always "text" unless you know, what you are doing
-'GRASS_GUI': "text",
-
-# GISBASE is place, where your GRASS installation is
-'GISBASE': "/usr/local/grass-6.1.cvs",
-
-# LD_LIBRARY_PATH
-'LD_LIBRARY_PATH':"/usr/local/grass-6.1.cvs/lib",
-
-# HOME has to be set
-'HOME':"/var/www",
+grassenv = {
+ # PATH in which your modules (processes) should be able the search.
+ # Default value:
+ 'PATH': "/usr/local/grass-6.1.cvs/bin/:/usr/local/grass-6.1.cvs/scripts/:\
+ /usr/bin/:/bin/:",
+
+ # Add eventually some other path, in which should GRASS search for modules
+ 'GRASS_ADDON_PATH': "",
+
+ # Version of GRASS, you are using
+ 'GRASS_VERSION': "6.1.cvs",
+
+ # GRASS_PERL, where is your PERL bin installed
+ 'GRASS_PERL': "/usr/bin/perl",
+
+ # GRASS_GUI should be always "text" unless you know, what you are doing
+ 'GRASS_GUI': "text",
+
+ # GISBASE is place, where your GRASS installation is
+ 'GISBASE': "/usr/local/grass-6.1.cvs",
+
+ # LD_LIBRARY_PATH
+ 'LD_LIBRARY_PATH':"/usr/local/grass-6.1.cvs/lib",
+
+ # HOME has to be set
+ 'HOME':"/var/www",
+}
\end{verbatim}
@@ -310,7 +347,7 @@
\note{This section has changed from previous stable 1.0.0 version. The
processes, you defined for 1.0.0 branch should work for 2.0.0 branch too.}
-All processes are stored in the processes directory. Put your file
+All processes are stored in the \texttt{processes} directory. Put your file
e.g. \texttt{myprocess.py} in there. Several example processes are
distributed along with PyWPS source code.
@@ -319,11 +356,10 @@
process metadata, inputs and outpus are defined and in
\texttt{execute(self)} method, own computation is performed.
+
It is possible also to add as many your functions, as you wish.
-
\subsection{Process Initialization and Configuration}
-
\begin{verbatim}
01 # importing necessary files
@@ -332,47 +368,30 @@
04 class Process(WPSProcess):
05 def __init__(self):
06 WPSProcess.__init__(self,
-07 Identifier="spearpath",
-18 Title="Spearfish path searching",
-19 Abstract="Find the shortest path on the roads map on Spearfish dataset",
+07 Identifier="ogr2ogr",
+18 Title="ogr2ogr interface",
+19 Abstract="Convert vector file to another format",
10 processVersion = "0.2",
11 statusSupported="true",
12 storeSupported="true")
\end{verbatim}
-We defined new process called \texttt{spearpath}. The process is allowed to
+We defined new process called \texttt{ogr2ogr}. The process is allowed to
store it's output data on the server (\texttt{storeSupported}) and it is also possible to run it in
asynchronous mode (\texttt{statusSupported}).
Eventually optional attributes can be found in the table 38 - "Parts of
-ExecuteResponse data structure". It is also possible to redefine some
+ExecuteResponse data structure" in the WPS reference
+document\footnote{\url{http://www.opengeospatial.org/standards/requests/28}}. It is also possible to redefine some
variable later, after initialization:
\begin{verbatim}
13
-14 self.Title="South Dacota path searching"
+14 self.Title="ogr2ogr interface"
15
\end{verbatim}
-\subsection{Running in GRASS session}
-You have to define GRASS Locatio\footnote{see e.g.
-\url{http://grass.itc.it/grass63/manuals/html63\_user/helptext.html} for details}
-If your process should happen in existing GRASS-Location, and you just need
-the input parameters for GRASS modules, you can specify it's name by
-\texttt{grassLocation} variable.
-
-\begin{verbatim}
-16 # use existing GRASS Location
-17 self.grassLocation="/var/grassdata/spearfish60/"
-18 # use temporary GRASS Location
-19 #self.grassLocation=None
-\end{verbatim}
-
-If this variable is set to \texttt{None}, new temporary GRASS Location \&\& mapset will be
-generated (using XY coordinate system) and you can work in there. The projection of the location will be
-XY. If this variable is not set, GRASS will not be stared.
-
\paragraph{Metadata defition} is stored in array \texttt{self.Metadata} in
\texttt{\_\_init\_\_} method. You can add new Medatada using
\texttt{self.AddMetadata()} method:
@@ -396,7 +415,21 @@
your process, you should use methods defined in \texttt{WPSProcess} class.
Four types of data inputs are defined:
+\begin{itemize}
+ \item Literal Input -- Basic literal input -- single number or text
+ value
+ \item ComplexValue Input -- Mostly vector file embded in input XML
+ request
+ \item ComplexValueReference Input -- URL to location, where the process
+ is supposed to get the input data.
+ \item BoundingBox Input -- Coordinates for lower-left and upper-right
+ corner.
+\end{itemize}
+ComplexValue and ComplexValueReference defined on the same way -- PyWPS is
+able to guess, if the input data are reference (link) to some map or raw
+data directly.
+
\paragraph{LiteralInput}
Basic type of data input is \texttt{LiteralInput} type. To define
@@ -469,11 +502,54 @@
\end{verbatim}
For further documentation, refere example processes distributed with the
-source code as well as \texttt{pydoc~pywps/wps/process.py}.
+source code as well as \texttt{pydoc~pywps/wps/process.py}. This help is
+also available in
+\texttt{process.html}\footnote{\href{http://wald.intevation.org/plugins/scmsvn/viewcvs.php/*checkout*/trunk/doc/process.html?rev=369&root=pywps}{Documentation
+to process.py module}} file distributed along with PyWPS
+source code.
-%FIXME this should be outstanding documentation
+\paragraph{ComplexInput}
+If the request comes as HTTP GET, it is assumed, that the input is only
+reference to some map. If it comes as HTTP POST, PyWPS tryes to guess, if
+the client is sending URL to source of the data or if the input data are
+part of input XML request (e.g. as GML file). So, you, as a process coder
+do not have to take care on this:
+\begin{verbatim}
+self.AddComplexInput(Indentifier="inputmap",
+ Title="Input map, which should be processed",
+ Formats=["text/xml","image/tiff"])
+...
+ <Input>
+ <ows:Identifier>input</ows:Identifier>
+ <ows:Title>Input raster map</ows:Title>
+ <ows:Abstract/>
+ <ComplexData defaultFormat="image/tiff">
+ <SupportedComplexData>
+ <Format>image/tiff</Format>
+ <Format>text/xml</Format>
+ </SupportedComplexData>
+ </ComplexData>
+ <MinimumOccurs>1</MinimumOccurs>
+ </Input>
+\end{verbatim}
+
+\paragraph{BoundingBox Input}
+With bounding box, you can define two coordinate pairs, if you have to.
+
+\begin{verbatim}
+self.AddBondingBoxInput(Identifier="bbox",
+ Title="BBox input")
+\end{verbatim}
+
\subsubsection{Data Outputs}
+Again four types of output are defined:
+\begin{itemize}
+ \item Literal Output
+ \item ComplexValue Output
+ \item ComplexValue Reference
+ \item BoundingBox Output
+\end{itemize}
Data outputs can be defined on similar way, using similar methods:
@@ -496,6 +572,7 @@
...
\end{verbatim}
+\paragraph{ComplexValue and ComplexValueReference Output}
To the oposite of data Inputs, Outputs can distinguish between ComplexValue
output and ComplexValueReference. ComplexValue is directly embed into the
output XML document and ComplexValueReference is stored on the server and
@@ -504,7 +581,7 @@
better to leave on the server.
\begin{verbatim}
-self.AddComplexValueReferenceOutput(Identifier="output",
+self.AddComplexReferenceOutput(Identifier="output",
Title="Resulting output map",
Formats=["image/tiff"])
@@ -522,15 +599,50 @@
...
\end{verbatim}
-Beside LiteralValue and ComplexValue, BoundingBoxValue is also defined. The
-coordinates are stored in array of four members:
+\paragraph{BoundingBox Output}
+Beside LiteralValue and ComplexValue, BoundingBoxValue is also defined.
+The coordinates are stored in array of four members:
\begin{verbatim}
self.GetInputValue("bboxinput")
[0,0,100,100]
\end{verbatim}
+\bigskip
+So on our \texttt{ogr2ogr} process, we have to define three types of input:
+\texttt{ComplexValue} of input vector file and EPSG codes of target and
+source files:
+
+\begin{verbatim}
+16 self.AddComplexInput(Identifier="inputmap",
+17 Title ="Input vector file",
+18 Abstract = "Input vector file to be converted",
+19 Formats=["text/xml"])
+20
+21 self.AddLiteralInput(Identifier="sepsg",
+22 Title="Source EPSG",
+23 Abstract="Source EPSG code",
+24 value=4326)
+\end{verbatim}
+
+
+And we also define two outputs: ComplexValueReference and ComplexValue
+type.
+
+
+\begin{verbatim}
+25 self.AddComplexOutput(Identifier="outputmap",
+26 Title ="Input vector file",
+27 Abstract = "Input vector file to be converted",
+28
+29 self.LiteralOutput(Identifier="sepsg",
+30 Title="Source EPSG",
+31 Abstract="Source EPSG code",
+32 value=4326)
+\end{verbatim}
+
+
\subsection{Process Programming}
The process must be defined in the \texttt{execute(self)} function. You can
@@ -552,22 +664,27 @@
\texttt{self.DataOutputs['identifier']} dictionary, is possible, but should
better not be used.}
+If you need to execute some shell command, you should use
+\texttt{self.Cmd(command,["string for standard input"])} instead of e.g.
+\texttt{os.system()} or \texttt{os.popen()} functions.
+
+
\begin{verbatim}
-22 def execute(self):
-23 if os.system("""g.region -d >&2"""):
-24 return "Could not set region to default"
-25
-26 os.system("r.in.gdal -o in=%s out=my_map >&2" %\
-27 (self.Inputs[0]['value']))
-28 os.system("r.mapcalc my_output=my_map+%d >&2" %\
-29 (self.DataInputs['value']))
-31
-32 if os.system("r.out.gdal type=Float32 out=map.tif in=my_output >&2"):
-33 return "Could not export resulting raster map [map.tif]"
-34
-35 self.Outputs[0]['value'] = "map.tif"
-36 self.DataOutputs['location'] = self.grassenv['LOCATION_NAME']
-37 return
+33
+35 def execute(self):
+36
+37 #
+38 # calculation
+39 #
+30 self.Cmd("""ogr2ogr -s_srs "+init=epsg:4326" -t_srs \
+31 "+init=epsg:2065" %s output.file""" % (self.GetInputValue("inputmap")))
+32 #
+43 # setting results
+44 #
+45 self.SetOutputValue("outputmap","output.file")
+46 self.SetOutputValue("sepsg","4326")
+47
+48 return
\end{verbatim}
\subsubsection{Error handling}
@@ -576,17 +693,96 @@
value means, that the calculation will be stopped and error report will be returned back to the client.
+\subsubsection{Using standard in- and output with external commands}
+The \texttt{self.Cmd()} accepts \texttt{input} parameter, wich is a text
+string, which is directred to standard input of the command:
-%---------------------------------------------------------------------
-\section{Note to grass programming}
+\begin{verbatim}
+ result = self.Cmd(cmd="wc -c",
+ input="calculate number of characters for this sentence")
+
+ # result[0].split()
+\end{verbatim}
+
+\texttt{self.Cmd()} returns list of lines from the programms standard
+output to the process:
+
+\begin{verbatim}
+
+ for line in self.Cmd("ls -l"):
+ # do some operations of list of files
+ pass
+\end{verbatim}
+
+
+\subsection{GRASS specific notes}
+
+Special class for GRASS GIS is defined too, which has functions and
+variables specific to this program. The process, in which should use GRASS
+modules should be defined as follows:
+
+\begin{verbatim}
+# importing necessary files
+import pywps.Wps.GRASSWPSProcess
+
+class Process(GRASSWPSProcess):
+ def __init__(self):
+ GRASSWPSProcess.__init__(self,
+ Identifier="spearpath",
+ Title="Spearfish path searching",
+ Abstract="Find the shortest path on the roads map on Spearfish dataset",
+ processVersion = "0.2",
+ statusSupported="true",
+ storeSupported="true",
+ # grassLocation="/var/www/spearfish60/" # work on existing location)
+\end{verbatim}
+
+By default, \texttt{self.grassLocation}\footnote{See e.g.
+\href{http://grass.itc.it/grass63/manuals/html63\_user/helptext.html}{GRASS
+manual} for details}
+ variable is set to \texttt{None},
+which means, that temporary location will be created and after the
+calculation is done, it will be deleted again. You can set this while
+process initialization or
+later\footnote{\texttt{self.grassLocation="/path/to/location"}}.
+
-\texttt{WMSProcess} class provides special method
-\texttt{self.Gcmd(command\_string)}, which tryes to catch output from GRASS
+\texttt{WPSProcess} class provides special method
+\texttt{self.GCmd(command\_string)}, which tryes to catch output from GRASS
modules, especially progress information inidcated by percent done. Method
-\texttt{Gcmd()} stores the output of GRASS modules to \texttt{self.status}
+\texttt{GCmd()} stores the output of GRASS modules to \texttt{self.status}
variable, so if the process is running assynchronously, client application
can track the progress of each module directly.
+\begin{verbatim}
+ def execute(self):
+ """
+ This function serves like simple GRASS - python script
+
+ It returns None, if process succeed or String if process failed
+ """
+ self.GCmd("g.region -d")
+
+
+ # v.net.path reads from standard input
+ self.GCmd("v.net.path in=roads out=path","0 %s %s %s %s" % (self.GetInputValue('x1'),
+ self.GetInputValue('y1'),
+ self.GetInputValue('x2'),
+ self.GetInputValue('y2')))
+
+ self.GCmd("v.out.ogr format=GML input=path dsn=out.xml olayer=path.xml")
+
+ if "out.xml" in os.listdir(os.curdir):
+ shutil.copy("out.xml","out2.xml")
+ self.SetOutputValue('outputReference',"out.xml")
+ self.SetOutputValue('outputData',"out2.xml")
+ return
+ else:
+ return "Ouput file not created!"
+\end{verbatim}
+
+%---------------------------------------------------------------------
+
It is also possible to run GRASS modules using python's
\texttt{os.system()} or \texttt{os.popen()} function. Before you do so, it
is important to import the \texttt{os} python package (usually one of the
@@ -606,8 +802,9 @@
""")
\end{verbatim}
-You can avoid this problem using formentioned \texttt{self.Gcmd()} method.
+You can avoid this problem using formentioned \texttt{self.GCmd()} method.
+
%---------------------------------------------------------------------
\section{Testing your new process}
@@ -675,7 +872,7 @@
The \texttt{execute-post.txt} file can look like follows:
\begin{verbatim}
-request=<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Execute service="WPS" version="0.4.0" store="false" status="false"
xmlns="http://www.opengeospatial.net/wps"
xmlns:ows="http://www.opengeospatial.net/ows"
@@ -792,9 +989,15 @@
self.status = ["Message", Percent_Done]
\end{verbatim}
and generate XML file in statusLocation with this embed message. E.g.
+
\begin{verbatim}
self.status = ["Generating raster map", 50]
\end{verbatim}
+or better
+\begin{verbatim}
+ self.SetStatus("Generarting raster map", 50_Done)
+\end{verbatim}
+
will become
\begin{verbatim}
@@ -805,12 +1008,9 @@
...
\end{verbatim}
-You can set also \texttt{self.status} variable using
-\texttt{self.SetStatus()} method.
-
\appendix
- \section{Sample process: \texttt{addvalue}}
+ \section{Example process: \texttt{addvalue}}
This sample process describes how to made your own WPS processes. Purpose of this process is:
\begin{itemize}
\item Download input raster map from some server
@@ -833,22 +1033,21 @@
# Copyright (C) 2006 Jachym Cepicky
import os,time,string,sys,shutil
-from pywps.Wps.process import WPSProcess
+from pywps.Wps.process import GRASSWPSProcess
-class Process (WPSProcess):
+class Process (GRASSWPSProcess):
#
# Initialization
#
def __init__(self):
- WPSProcess.__init__(self,
+ GRASSWPSProcess.__init__(self,
Identifier="Addvalue",
Title="Add some value to input raster map",
processVersion = "0.2",
statusSupported="true",
- storeSupported="true")
+ storeSupported="true",
+ grassLocation = None)
- # define GRASS location -- use temporary one
- self.grassLocation = None
#
# Inputs
@@ -861,7 +1060,7 @@
#
# Outputs
- self.AddComplexValueReferenceOutput(Identifier="output",
+ self.AddComplexReferenceOutput(Identifier="output",
Title="Resulting output map",
Formats=["image/tiff"])
#
@@ -878,7 +1077,7 @@
# import of the data
self.SetStatus("Importing data")
- if not self.Gcmd("r.in.gdal -o in=%s out=input" %\
+ if not self.GCmd("r.in.gdal -o in=%s out=input" %\
(self.GetInputValue("input"))):
return "Could not import raster file"
self.SetStatus("Importing data",10)
@@ -887,19 +1086,19 @@
for gdalinfoln in os.popen("gdalinfo %s" %\
(self.GetInputValue("input"))):
if gdalinfoln.split()[0] == "Band" and gdalinfoln.split()[1] == "3":
- self.Gcmd("""g.region rast=input.red """)
- self.Gcmd("r.composite r=input.red b=input.blue g=input.green out=input")
+ self.GCmd("""g.region rast=input.red """)
+ self.GCmd("r.composite r=input.red b=input.blue g=input.green out=input")
# region setting
- self.Gcmd("""g.region rast=input""")
+ self.GCmd("""g.region rast=input""")
# adding the value
self.SetStatus("Adding new value to raster map",50)
- self.Gcmd("r.mapcalc output='input+%f'" % float(self.GetInputValue('value')))
+ self.GCmd("r.mapcalc output='input+%f'" % float(self.GetInputValue('value')))
# output
self.SetStatus("Raster file export", 90)
- self.Gcmd("r.out.gdal type=Int32 in=output out=%s" % "output.tif")
+ self.GCmd("r.out.gdal type=Int32 in=output out=%s" % "output.tif")
# setting output values
self.SetOutputValue("output","output.tif")
Modified: trunk/doc/install.txt
===================================================================
--- trunk/doc/install.txt 2007-06-10 10:42:44 UTC (rev 371)
+++ trunk/doc/install.txt 2007-06-12 08:34:48 UTC (rev 372)
@@ -16,35 +16,35 @@
In this file, you can found the description of installation and
configuration of PyWPS script. At the and, you can learn, how to add
your own process to the list of processes. The file describes most
- recent version of PyWPS (SVN), available in subversion respository.
+ recent version of PyWPS (2.0.0), available in subversion respository.
PyPWS project has been started on April 2006 with support of DBU -
Deutsche Bundesstiftung Umwelt ([1]http://dbu.de) and with help of
GDF-Hannover ([2]http://gdf-hannover.de) and Help Service Remote
- Sensing ([3]http:/bnhelp.cz) companies. Initial author is Jachym
+ Sensing ([3]http://www.bnhelp.cz) companies. Initial author is Jachym
Cepicky ([4]http://les-ejk.cz).
Contents
* [5]Introduction
- * [6]Bugs
- * [7]Installation
- + [8]Installation the quick 'n' dirty way
- + [9]Installation the 'clean' way
- + [10]Testing after installation
- * [11]Configuration
- + [12]etc/settings.py
- + [13]etc/grass.py
- * [14]Add your own processes
- + [15]Process Initialization and Configuration
- + [16]Running in GRASS session
+ + [6]How it works
+ * [7]Bugs
+ * [8]Installation
+ + [9]Installation the quick 'n' dirty way
+ + [10]Installation the 'clean' way
+ + [11]Testing after installation
+ * [12]Configuration
+ + [13]etc/settings.py
+ + [14]etc/grass.py
+ * [15]Add your own processes
+ + [16]Process Initialization and Configuration
+ [17]Process Programming
- * [18]Note to grass programming
+ + [18]GRASS specific notes
* [19]Testing your new process
* [20]Using PyWPS
+ [21]Input
+ [22]Output
- * [23]Sample process: addvalue
+ * [23]Example process: addvalue
* [24]KVP request encoding of addvalue
* [25]XML request encoding addvalue
* [26]Licence of PyWPS
@@ -70,6 +70,18 @@
PyWPS Homepage can be found at [28]http://pywps.wald.intevation.org.
PyWPS Wiki is hosted on [29]http://pywps.ominiverdi.org.
+How it works
+
+ PyWPS is an translator application between client (Web Browser,
+ Desktop GIS, command line tool, ...) and working tool installed on the
+ server. PyWPS does no work by it self. As working tool, GRASS GIS,
+ GDAL, PROJ, R and other programs can be used.
+
+ CAPTION: Figure 1: How does PyWPS work: GRASS GIS is in this case
+ working tool
+
+ Image pywps-schema
+
Bugs
Known bugs and limitations to UL>
@@ -82,49 +94,57 @@
not controlled properly. Take care on your inputs and do not use it
directly in scripts to avoid your server to be hacked.
- Please report all problems or unexpected handeling.
+ Please report all problems or unexpected handeling either via pywps
+ mailing list[30]^1or using PyWPS bugtracker[31]^2.
Installation
Required packages:
- * Web Server (e.g. Apache)
* python
* python-xml
Recommended packages:
- * GIS GRASS - [30]http://grass.itc.it - Geographical Resources
+ * Web Server (e.g. Apache) - [32]http://httpd.apache.org - You will
+ need an web server, to be able to execute processes from remote
+ computers.
+ * GIS GRASS - [33]http://grass.itc.it - Geographical Resources
Analysis Support System (GRASS) is Open Source GIS, which provides
more then 350 modules for raster and vector (2D, 3D) data
analysis. PyWPS is written with native support for GRASS and it's
functions.
- * PROJ.4 - [31]http://proj.maptools.org - Cartographic Projections
+ * PROJ.4 - [34]http://proj.maptools.org - Cartographic Projections
library used in various Open Source projects, such as GRASS, UMN
MapServer, QGIS and others. It can be used e.g. for data
transformation.
- * GDAL/OGR - [32]http://gdal.org - translator library for raster
+ * GDAL/OGR - [35]http://gdal.org - translator library for raster
geospatial data formats, is used in various projects for
importing, exporting and transformation between various raster and
vector data formats.
- * R - [33]http://www.r-project.org - is a language and environment
+ * R - [36]http://www.r-project.org - is a language and environment
for statistical computing and graphics.
Installation the quick 'n' dirty way
For installing pywps to your server simply unzip the archive to the
- directory, where cgi programs are allowed to run.
+ directory, where cgi programs are allowed to run. You can also use
+ current repository version.
+$ cd /usr/lib/cgi-bin/
+$ tar xvzf /tmp/pywps-VERSION.tar.gz
+$ pywps/wps.py
+
Installation the 'clean' way
- Unzip the package gray!25
+ Unzip the package
$ tar -xzf pywps-VERSION.tar.gz
and run
$ python setup.py install
Several binary packages for Linux distributios are also avaliable on
- PyWPS site[34]^1.
+ PyWPS site[37]^3.
Testing after installation
@@ -157,7 +177,7 @@
Before you start to tune your pywps program, you should get your copy
of OpenGIS(R) Web Processing Service document (OGC 05-007r4) version
0.4.0 from
- [35]http://www.opengeospatial.org/specs/?page=specs
+ [38]http://www.opengeospatial.org/specs/?page=specs
NOTE: Note, that the configuration option are CASE SENSITIVE
@@ -166,10 +186,12 @@
python programming language. But you should be able to setup the
program without any python knowledge.
- The first file is in etcsettings.py and (optional) the second file is
- etcgrass.py which has to be setuped if you do want to use GRASS GIS
+ The first file is in etc/settings.py and (optional) the second file is
+ etc/grass.py which has to be setuped if you do want to use GRASS GIS
modules in your scripts. Some special "tuning" can be done in
- processes/__init__.py file
+ processes/__init__.py file. You can allways obtain original
+ configuration files from Wps/default_settings.py and
+ Wps/default_grass.py.
etc/settings.py
@@ -179,94 +201,101 @@
mostly in GetCapabilities request. The mandatory parameters, which
should be set up are (with default/recommend values):
-'version': "0.4.0",
-'ServiceIdentification': {
- 'Title':"Jachym's WPS server",
- 'ServiceType':"WPS",
- 'ServiceTypeVersion':"0.1.0",
- 'Abstract':'Abstract to this WPS',
-},
-'ServiceProvider': {
- 'ProviderName' : "Your Company",
- 'IndividualName':"Your Name",
- 'PositionName':"Your Position",
- 'Role':"your role",
- 'DeliveryPoint': "Street",
- 'City': "City",
- 'PostalCode':"00000",
- 'Country': "Your country",
- 'ElectronicMailAddress':"your.email at address",
-},
+WPS = {
+ 'version': "0.4.0",
+ 'ServiceIdentification': {
+ 'Title':"Jachym's WPS server",
+ 'ServiceType':"WPS",
+ 'ServiceTypeVersion':"0.1.0",
+ 'Abstract':'Abstract to this WPS',
+ },
+ 'ServiceProvider': {
+ 'ProviderName' : "Your Company",
+ 'IndividualName':"Your Name",
+ 'PositionName':"Your Position",
+ 'Role':"your role",
+ 'DeliveryPoint': "Street",
+ 'City': "City",
+ 'PostalCode':"00000",
+ 'Country': "Your country",
+ 'ElectronicMailAddress':"your.email at address",
+ },
-'OperationsMetadata': {
- 'ServerAddress' : "http://localhost/cgi-bin/wps/wps.py",
-},
-'Keywords' : ['GRASS','GIS','WPS'],
+ 'OperationsMetadata': {
+ 'ServerAddress' : "http://localhost/cgi-bin/wps/wps.py",
+ },
+ 'Keywords' : ['GRASS','GIS','WPS'],
+}
In the ServerSettings section, the variables are set, which have
impact on the whole server.
-# NOTE: You have to create this directory manually and set rights, so
-# the program is able to store data in there
-'outputPath': '/var/www/wpsoutputs',
+ServerSettings = {
+ # NOTE: You have to create this directory manually and set rights, so
+ # the program is able to store data in there
+ 'outputPath': '/var/www/wpsoutputs',
-#
-# 'outputUrl' - URL of the directory, where the outputs will be stored
-'outputUrl': 'http://192.168.1.31/wpsoutputs',
+ #
+ # 'outputUrl' - URL of the directory, where the outputs will be stored
+ 'outputUrl': 'http://192.168.1.31/wpsoutputs',
-#
-# tempPath - path to directory, where temporary data will be stored.
-# NOTE: the pywps has to have rights, to create directories and files
-# in this directory
-'tempPath': '/tmp',
+ #
+ # tempPath - path to directory, where temporary data will be stored.
+ # NOTE: the pywps has to have rights, to create directories and files
+ # in this directory
+ 'tempPath': '/tmp',
-#
-# maxOperations - maximum number of operations, which is allowed to low
-# on this server at ones
-# default = 1
-'maxOperations':1,
+ #
+ # maxOperations - maximum number of operations, which is allowed to low
+ # on this server at ones
+ # default = 1
+ 'maxOperations':1,
-#
-# maxSize: maximum input file size in bytes
-# NOTE: maximum file size is 5MB, no care, if this number is higher
-'maxSize':5242880, # 5 MB
+ #
+ # maxSize: maximum input file size in bytes
+ # NOTE: maximum file size is 5MB, no care, if this number is higher
+ 'maxSize':5242880, # 5 MB
-#
-# maxInputParamLength: maximal length of input values
-# NOTE: maximum length of input parameters is 256, no matter, how height
-# is this number
-'maxInputParamLength':256,
+ #
+ # maxInputParamLength: maximal length of input values
+ # NOTE: maximum length of input parameters is 256, no matter, how heigh
+t
+ # is this number
+ 'maxInputParamLength':256,
+}
etc/grass.py
This file servers for configuration of GRASS GIS environment (if your
processes need one). Everything is stored in grassenv structure.
-# PATH in which your modules (processes) should be able the search.
-# Default value:
-'PATH': "/usr/local/grass-6.1.cvs/bin/:/usr/local/grass-6.1.cvs/scripts/:\
-/usr/bin/:/bin/:",
+grassenv = {
+ # PATH in which your modules (processes) should be able the search.
+ # Default value:
+ 'PATH': "/usr/local/grass-6.1.cvs/bin/:/usr/local/grass-6.1.cvs/scripts/:\
+ /usr/bin/:/bin/:",
-# Add eventually some other path, in which should GRASS search for modules
-'GRASS_ADDON_PATH': "",
+ # Add eventually some other path, in which should GRASS search for modules
+ 'GRASS_ADDON_PATH': "",
-# Version of GRASS, you are using
-'GRASS_VERSION': "6.1.cvs",
+ # Version of GRASS, you are using
+ 'GRASS_VERSION': "6.1.cvs",
-# GRASS_PERL, where is your PERL bin installed
-'GRASS_PERL': "/usr/bin/perl",
+ # GRASS_PERL, where is your PERL bin installed
+ 'GRASS_PERL': "/usr/bin/perl",
-# GRASS_GUI should be always "text" unless you know, what you are doing
-'GRASS_GUI': "text",
+ # GRASS_GUI should be always "text" unless you know, what you are doing
+ 'GRASS_GUI': "text",
-# GISBASE is place, where your GRASS installation is
-'GISBASE': "/usr/local/grass-6.1.cvs",
+ # GISBASE is place, where your GRASS installation is
+ 'GISBASE': "/usr/local/grass-6.1.cvs",
-# LD_LIBRARY_PATH
-'LD_LIBRARY_PATH':"/usr/local/grass-6.1.cvs/lib",
+ # LD_LIBRARY_PATH
+ 'LD_LIBRARY_PATH':"/usr/local/grass-6.1.cvs/lib",
-# HOME has to be set
-'HOME':"/var/www",
+ # HOME has to be set
+ 'HOME':"/var/www",
+}
Add your own processes
@@ -293,42 +322,26 @@
04 class Process(WPSProcess):
05 def __init__(self):
06 WPSProcess.__init__(self,
-07 Identifier="spearpath",
-18 Title="Spearfish path searching",
-19 Abstract="Find the shortest path on the roads map on Spearfis
-h dataset",
+07 Identifier="ogr2ogr",
+18 Title="ogr2ogr interface",
+19 Abstract="Convert vector file to another format",
10 processVersion = "0.2",
11 statusSupported="true",
12 storeSupported="true")
- We defined new process called spearpath. The process is allowed to
- store it's output data on the server (storeSupported) and it is also
+ We defined new process called ogr2ogr. The process is allowed to store
+ it's output data on the server (storeSupported) and it is also
possible to run it in asynchronous mode (statusSupported).
Eventually optional attributes can be found in the table 38 - "Parts
- of ExecuteResponse data structure". It is also possible to redefine
- some variable later, after initialization:
+ of ExecuteResponse data structure" in the WPS reference
+ document[39]^4. It is also possible to redefine some variable later,
+ after initialization:
13
-14 self.Title="South Dacota path searching"
+14 self.Title="ogr2ogr interface"
15
-Running in GRASS session
-
- You have to define GRASS Locatio[36]^2 If your process should happen
- in existing GRASS-Location, and you just need the input parameters for
- GRASS modules, you can specify it's name by grassLocation variable.
-
-16 # use existing GRASS Location
-17 self.grassLocation="/var/grassdata/spearfish60/"
-18 # use temporary GRASS Location
-19 #self.grassLocation=None
-
- If this variable is set to None, new temporary GRASS Location &&
- mapset will be generated (using XY coordinate system) and you can work
- in there. The projection of the location will be XY. If this variable
- is not set, GRASS will not be stared.
-
Metadata defition
is stored in array self.Metadata in __init__ method. You can add new
@@ -350,7 +363,18 @@
process, you should use methods defined in WPSProcess class.
Four types of data inputs are defined:
+ * Literal Input - Basic literal input - single number or text value
+ * ComplexValue Input - Mostly vector file embded in input XML
+ request
+ * ComplexValueReference Input - URL to location, where the process
+ is supposed to get the input data.
+ * BoundingBox Input - Coordinates for lower-left and upper-right
+ corner.
+ ComplexValue and ComplexValueReference defined on the same way - PyWPS
+ is able to guess, if the input data are reference (link) to some map
+ or raw data directly.
+
LiteralInput
Basic type of data input is LiteralInput type. To define LiteralInput
@@ -419,10 +443,51 @@
...
For further documentation, refere example processes distributed with
- the source code as well as pydoc pywps/wps/process.py.
+ the source code as well as pydoc pywps/wps/process.py. This help is
+ also available in process.html[40]^5 file distributed along with PyWPS
+ source code.
+ ComplexInput
+
+ If the request comes as HTTP GET, it is assumed, that the input is
+ only reference to some map. If it comes as HTTP POST, PyWPS tryes to
+ guess, if the client is sending URL to source of the data or if the
+ input data are part of input XML request (e.g. as GML file). So, you,
+ as a process coder do not have to take care on this:
+
+self.AddComplexInput(Indentifier="inputmap",
+ Title="Input map, which should be processed",
+ Formats=["text/xml","image/tiff"])
+...
+ <Input>
+ <ows:Identifier>input</ows:Identifier>
+ <ows:Title>Input raster map</ows:Title>
+ <ows:Abstract/>
+ <ComplexData defaultFormat="image/tiff">
+ <SupportedComplexData>
+ <Format>image/tiff</Format>
+ <Format>text/xml</Format>
+ </SupportedComplexData>
+ </ComplexData>
+ <MinimumOccurs>1</MinimumOccurs>
+ </Input>
+
+ BoundingBox Input
+
+ With bounding box, you can define two coordinate pairs, if you have
+ to.
+
+self.AddBondingBoxInput(Identifier="bbox",
+ Title="BBox input")
+
Data Outputs
+ Again four types of output are defined:
+ * Literal Output
+ * ComplexValue Output
+ * ComplexValue Reference
+ * BoundingBox Output
+
Data outputs can be defined on similar way, using similar methods:
LiteralOutput
@@ -443,6 +508,8 @@
</Output>
...
+ ComplexValue and ComplexValueReference Output
+
To the oposite of data Inputs, Outputs can distinguish between
ComplexValue output and ComplexValueReference. ComplexValue is
directly embed into the output XML document and ComplexValueReference
@@ -450,7 +517,7 @@
to it. In general, vector files in GML format can be easy embed to the
output XML, TIFF raster files is better to leave on the server.
-self.AddComplexValueReferenceOutput(Identifier="output",
+self.AddComplexReferenceOutput(Identifier="output",
Title="Resulting output map",
Formats=["image/tiff"])
@@ -467,12 +534,40 @@
</Output>
...
+ BoundingBox Output
+
Beside LiteralValue and ComplexValue, BoundingBoxValue is also
defined. The coordinates are stored in array of four members:
self.GetInputValue("bboxinput")
[0,0,100,100]
+ So on our ogr2ogr process, we have to define three types of input:
+ ComplexValue of input vector file and EPSG codes of target and source
+ files:
+
+16 self.AddComplexInput(Identifier="inputmap",
+17 Title ="Input vector file",
+18 Abstract = "Input vector file to be converted",
+19 Formats=["text/xml"])
+20
+21 self.AddLiteralInput(Identifier="sepsg",
+22 Title="Source EPSG",
+23 Abstract="Source EPSG code",
+24 value=4326)
+
+ And we also define two outputs: ComplexValueReference and ComplexValue
+ type.
+
+25 self.AddComplexOutput(Identifier="outputmap",
+26 Title ="Input vector file",
+27 Abstract = "Input vector file to be converted",
+28
+29 self.LiteralOutput(Identifier="sepsg",
+30 Title="Source EPSG",
+31 Abstract="Source EPSG code",
+32 value=4326)
+
Process Programming
The process must be defined in the execute(self) function. You can
@@ -494,46 +589,111 @@
self.DataOutputs['identifier'] dictionary, is possible, but should
better not be used.
-22 def execute(self):
-23 if os.system("""g.region -d >&2"""):
+ If you need to execute some shell command, you should use
+ self.Cmd(command,["string for standard input"]) instead of e.g.
+ os.system() or os.popen() functions.
-24 return "Could not set region to default"
+33
+35 def execute(self):
+36
+37 #
+38 # calculation
+39 #
+30 self.Cmd("""ogr2ogr -s_srs "+init=epsg:4326" -t_srs \
+31 "+init=epsg:2065" %s output.file""" % (self.GetInputValue("inputmap
+")))
+32 #
+43 # setting results
+44 #
+45 self.SetOutputValue("outputmap","output.file")
+46 self.SetOutputValue("sepsg","4326")
+47
+48 return
-25
+ Error handling
-26 os.system("r.in.gdal -o in=%s out=my_map >&2" %\
+ At the end of the execute function, None value should be returned. Any
+ other value means, that the calculation will be stopped and error
+ report will be returned back to the client.
-27 (self.Inputs[0]['value']))
+ Using standard in- and output with external commands
-28 os.system("r.mapcalc my_output=my_map+%d >&2" %\
+ The self.Cmd() accepts input parameter, wich is a text string, which
+ is directred to standard input of the command:
-29 (self.DataInputs['value']))
+ result = self.Cmd(cmd="wc -c",
+ input="calculate number of characters for this sentence")
-31
-32 if os.system("r.out.gdal type=Float32 out=map.tif in=my_output >&2"
-):
-33 return "Could not export resulting raster map [map.tif]"
-34
+ # result[0].split()
-35 self.Outputs[0]['value'] = "map.tif"
-36 self.DataOutputs['location'] = self.grassenv['LOCATION_NAME']
-37 return
+ self.Cmd() returns list of lines from the programms standard output to
+ the process:
- Error handling
+ for line in self.Cmd("ls -l"):
+ # do some operations of list of files
+ pass
- At the end of the execute function, None value should be returned. Any
- other value means, that the calculation will be stopped and error
- report will be returned back to the client.
+GRASS specific notes
- Note to grass programming
+ Special class for GRASS GIS is defined too, which has functions and
+ variables specific to this program. The process, in which should use
+ GRASS modules should be defined as follows:
- WMSProcess class provides special method self.Gcmd(command_string),
+# importing necessary files
+import pywps.Wps.GRASSWPSProcess
+
+class Process(GRASSWPSProcess):
+ def __init__(self):
+ GRASSWPSProcess.__init__(self,
+ Identifier="spearpath",
+ Title="Spearfish path searching",
+ Abstract="Find the shortest path on the roads map on Spearfish d
+ataset",
+ processVersion = "0.2",
+ statusSupported="true",
+ storeSupported="true",
+ # grassLocation="/var/www/spearfish60/" # work on existing locat
+ion)
+
+ By default, self.grassLocation[41]^6 variable is set to None, which
+ means, that temporary location will be created and after the
+ calculation is done, it will be deleted again. You can set this while
+ process initialization or later[42]^7.
+
+ WPSProcess class provides special method self.GCmd(command_string),
which tryes to catch output from GRASS modules, especially progress
- information inidcated by percent done. Method Gcmd() stores the output
+ information inidcated by percent done. Method GCmd() stores the output
of GRASS modules to self.status variable, so if the process is running
assynchronously, client application can track the progress of each
module directly.
+ def execute(self):
+ """
+ This function serves like simple GRASS - python script
+
+ It returns None, if process succeed or String if process failed
+ """
+ self.GCmd("g.region -d")
+
+
+ # v.net.path reads from standard input
+ self.GCmd("v.net.path in=roads out=path","0 %s %s %s %s" % (self.GetInp
+utValue('x1'),
+ self.GetInputValue('y1'),
+ self.GetInputValue('x2'),
+ self.GetInputValue('y2')))
+
+ self.GCmd("v.out.ogr format=GML input=path dsn=out.xml olayer=path.xml"
+)
+
+ if "out.xml" in os.listdir(os.curdir):
+ shutil.copy("out.xml","out2.xml")
+ self.SetOutputValue('outputReference',"out.xml")
+ self.SetOutputValue('outputData',"out2.xml")
+ return
+ else:
+ return "Ouput file not created!"
+
It is also possible to run GRASS modules using python's os.system() or
os.popen() function. Before you do so, it is important to import the
os python package (usually one of the first lines in the file). This
@@ -550,7 +710,7 @@
echo "Rekni jim drazi, tatko, za to nic nedas." >&2
""")
- You can avoid this problem using formentioned self.Gcmd() method.
+ You can avoid this problem using formentioned self.GCmd() method.
Testing your new process
@@ -605,7 +765,7 @@
"http://localhost/pywps/wps.py" -O - -nv -q
The execute-post.txt file can look like follows:
-request=<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Execute service="WPS" version="0.4.0" store="false" status="false"
xmlns="http://www.opengeospatial.net/wps"
xmlns:ows="http://www.opengeospatial.net/ows"
@@ -716,8 +876,12 @@
self.status = ["Message", Percent_Done]
and generate XML file in statusLocation with this embed message. E.g.
+
self.status = ["Generating raster map", 50]
+ or better
+ self.SetStatus("Generarting raster map", 50_Done)
+
will become
...
@@ -727,10 +891,8 @@
</Status>
...
- You can set also self.status variable using self.SetStatus() method.
+ Example process: addvalue
- Sample process: addvalue
-
This sample process describes how to made your own WPS processes.
Purpose of this process is:
* Download input raster map from some server
@@ -753,22 +915,21 @@
# Copyright (C) 2006 Jachym Cepicky
import os,time,string,sys,shutil
-from pywps.Wps.process import WPSProcess
+from pywps.Wps.process import GRASSWPSProcess
-class Process (WPSProcess):
+class Process (GRASSWPSProcess):
#
# Initialization
#
def __init__(self):
- WPSProcess.__init__(self,
+ GRASSWPSProcess.__init__(self,
Identifier="Addvalue",
Title="Add some value to input raster map",
processVersion = "0.2",
statusSupported="true",
- storeSupported="true")
+ storeSupported="true",
+ grassLocation = None)
- # define GRASS location -- use temporary one
- self.grassLocation = None
#
# Inputs
@@ -781,7 +942,7 @@
#
# Outputs
- self.AddComplexValueReferenceOutput(Identifier="output",
+ self.AddComplexReferenceOutput(Identifier="output",
Title="Resulting output map",
Formats=["image/tiff"])
#
@@ -798,7 +959,7 @@
# import of the data
self.SetStatus("Importing data")
- if not self.Gcmd("r.in.gdal -o in=%s out=input" %\
+ if not self.GCmd("r.in.gdal -o in=%s out=input" %\
(self.GetInputValue("input"))):
return "Could not import raster file"
self.SetStatus("Importing data",10)
@@ -808,21 +969,21 @@
(self.GetInputValue("input"))):
if gdalinfoln.split()[0] == "Band" and gdalinfoln.split()[1] == "3"
:
- self.Gcmd("""g.region rast=input.red """)
- self.Gcmd("r.composite r=input.red b=input.blue g=input.green o
+ self.GCmd("""g.region rast=input.red """)
+ self.GCmd("r.composite r=input.red b=input.blue g=input.green o
ut=input")
# region setting
- self.Gcmd("""g.region rast=input""")
+ self.GCmd("""g.region rast=input""")
# adding the value
self.SetStatus("Adding new value to raster map",50)
- self.Gcmd("r.mapcalc output='input+%f'" % float(self.GetInputValue('val
+ self.GCmd("r.mapcalc output='input+%f'" % float(self.GetInputValue('val
ue')))
# output
self.SetStatus("Raster file export", 90)
- self.Gcmd("r.out.gdal type=Int32 in=output out=%s" % "output.tif")
+ self.GCmd("r.out.gdal type=Int32 in=output out=%s" % "output.tif")
# setting output values
self.SetOutputValue("output","output.tif")
@@ -1531,78 +1692,107 @@
Implementation of OGC's WPS standard: PyWPS
- This document was generated using the [37]LaTeX2HTML translator
+ This document was generated using the [43]LaTeX2HTML translator
Version 2002-2-1 (1.71)
- Copyright © 1993, 1994, 1995, 1996, [38]Nikos Drakos, Computer Based
+ Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based
Learning Unit, University of Leeds.
- Copyright © 1997, 1998, 1999, [39]Ross Moore, Mathematics Department,
+ Copyright © 1997, 1998, 1999, [44]Ross Moore, Mathematics Department,
Macquarie University, Sydney.
The command line arguments were:
latex2html -split 0 install.tex
- The translation was initiated by Jachym Cepicky on 2007-03-15
+ The translation was initiated by Jachym Cepicky on 2007-06-12
_________________________________________________________________
Footnotes
- ... site[40]^1
- [41]http://pywps.wald.intevation.org
+ ... list[45]^1
+ http://wald.intevation.org/mailman/listinfo/pywps-develPyWPS -
+ development list
- ... Locatio[42]^2
- see e.g.
- [43]http://grass.itc.it/grass63/manuals/html63_user/helptext.ht
- ml for details
+ ... bugtracker[46]^2
+ http://wald.intevation.org/tracker/?atid=174&group_id=22&func=b
+ rowsePyWPS Bug tracker
+
+ ... site[47]^3
+ [48]http://pywps.wald.intevation.org
+
+ ... document[49]^4
+ [50]http://www.opengeospatial.org/standards/requests/28
+
+ ...process.html[51]^5
+ http://wald.intevation.org/plugins/scmsvn/viewcvs.php/*checkout
+ */trunk/doc/process.html?rev=369&root=pywpsDocumentation to
+ process.py module
+
+ ...self.grassLocation[52]^6
+ See e.g.
+ http://grass.itc.it/grass63/manuals/html63_user/helptext.htmlGR
+ ASS manual for details
+
+ ... later[53]^7
+ self.grassLocation="/path/to/location"
_________________________________________________________________
next_inactive up previous
- Jachym Cepicky 2007-03-15
+ Jachym Cepicky 2007-06-12
Reference
1. http://dbu.de/
2. http://gdf-hannover.de/
- 3. http:/bnhelp.cz
+ 3. http://www.bnhelp.cz/
4. http://les-ejk.cz/
5. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00020000000000000000
- 6. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00030000000000000000
- 7. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00040000000000000000
- 8. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00041000000000000000
- 9. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00042000000000000000
- 10. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00043000000000000000
- 11. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00050000000000000000
- 12. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00051000000000000000
- 13. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00052000000000000000
- 14. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00060000000000000000
- 15. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00061000000000000000
- 16. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00062000000000000000
- 17. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00063000000000000000
- 18. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00070000000000000000
- 19. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00080000000000000000
- 20. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00090000000000000000
- 21. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00091000000000000000
- 22. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00092000000000000000
- 23. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000100000000000000000
- 24. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000110000000000000000
- 25. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000120000000000000000
- 26. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000130000000000000000
- 27. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000140000000000000000
+ 6. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00021000000000000000
+ 7. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00030000000000000000
+ 8. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00040000000000000000
+ 9. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00041000000000000000
+ 10. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00042000000000000000
+ 11. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00043000000000000000
+ 12. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00050000000000000000
+ 13. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00051000000000000000
+ 14. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00052000000000000000
+ 15. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00060000000000000000
+ 16. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00061000000000000000
+ 17. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00062000000000000000
+ 18. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00063000000000000000
+ 19. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00070000000000000000
+ 20. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00080000000000000000
+ 21. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00081000000000000000
+ 22. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00082000000000000000
+ 23. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION00090000000000000000
+ 24. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000100000000000000000
+ 25. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000110000000000000000
+ 26. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000120000000000000000
+ 27. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#SECTION000130000000000000000
28. http://pywps.wald.intevation.org/
29. http://pywps.ominiverdi.org/
- 30. http://grass.itc.it/
- 31. http://proj.maptools.org/
- 32. http://gdal.org/
- 33. http://www.r-project.org/
- 34. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot60
- 35. http://www.opengeospatial.org/specs/?page=specs
- 36. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot305
- 37. http://www.latex2html.org/
- 38. http://cbl.leeds.ac.uk/nikos/personal.html
- 39. http://www.maths.mq.edu.au/~ross/
- 40. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html11
- 41. http://pywps.wald.intevation.org/
- 42. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html14
- 43. http://grass.itc.it/grass63/manuals/html63_user/helptext.html
+ 30. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot357
+ 31. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot358
+ 32. http://httpd.apache.org/
+ 33. http://grass.itc.it/
+ 34. http://proj.maptools.org/
+ 35. http://gdal.org/
+ 36. http://www.r-project.org/
+ 37. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot75
+ 38. http://www.opengeospatial.org/specs/?page=specs
+ 39. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot361
+ 40. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot362
+ 41. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot365
+ 42. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#foot366
+ 43. http://www.latex2html.org/
+ 44. http://www.maths.mq.edu.au/~ross/
+ 45. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html8
+ 46. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html9
+ 47. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html15
+ 48. http://pywps.wald.intevation.org/
+ 49. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html18
+ 50. http://www.opengeospatial.org/standards/requests/28
+ 51. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html20
+ 52. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html21
+ 53. file://localhost/home/jachym/src/pywps/trunk/doc/install.html#tex2html22
Added: trunk/doc/pic/Rlogo.png
===================================================================
(Binary files differ)
Property changes on: trunk/doc/pic/Rlogo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/doc/pic/pywps-schema.dia
===================================================================
(Binary files differ)
Modified: trunk/doc/pic/pywps-schema.png
===================================================================
(Binary files differ)
Deleted: trunk/doc/process-2007-03-15.html
===================================================================
--- trunk/doc/process-2007-03-15.html 2007-06-10 10:42:44 UTC (rev 371)
+++ trunk/doc/process-2007-03-15.html 2007-06-12 08:34:48 UTC (rev 372)
@@ -1,139 +0,0 @@
-
-<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html><head><title>Python: module process</title>
-</head><body bgcolor="#f0f0f8">
-
-<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
-<tr bgcolor="#7799ee">
-<td valign=bottom> <br>
-<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>process</strong></big></big></font></td
-><td align=right valign=bottom
-><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/jachym/src/pywps/trunk/pywps/Wps/process.py">/home/jachym/src/pywps/trunk/pywps/Wps/process.py</a></font></td></tr></table>
- <p><tt># Licence: GNU/GPL<br>
-# Author: Jachym Cepicky 2007<br>
-# jachym.cepicky gmail com<br>
-# <a href="http://les-ejk.cz">http://les-ejk.cz</a></tt></p>
-<p>
-<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
-<tr bgcolor="#aa55cc">
-<td colspan=3 valign=bottom> <br>
-<font color="#fffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
-
-<tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td>
-<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="os.html">os</a><br>
-</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
-</td><td width="25%" valign=top></td><td width="25%" valign=top></td></tr></table></td></tr></table><p>
-<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
-<tr bgcolor="#ee77aa">
-<td colspan=3 valign=bottom> <br>
-<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
-
-<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
-<td width="100%"><dl>
-<dt><font face="helvetica, arial"><a href="process.html#WPSProcess">WPSProcess</a>
-</font></dt></dl>
- <p>
-<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
-<tr bgcolor="#ffc8d8">
-<td colspan=3 valign=bottom> <br>
-<font color="#000000" face="helvetica, arial"><a name="WPSProcess">class <strong>WPSProcess</strong></a></font></td></tr>
-
-<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
-<td colspan=2><tt>This class is to be used as base class for WPS processes in PyWPS<br>
-script. To be able to use it's methods (functions), you have to start<br>
-your process with following lines:<br>
- <br>
-from pywps.Wps.process import <a href="#WPSProcess">WPSProcess</a><br>
- <br>
-class Process(<a href="#WPSProcess">WPSProcess</a>):<br>
- def <a href="#WPSProcess-__init__">__init__</a>(self):<br>
- <a href="#WPSProcess">WPSProcess</a>.<a href="#WPSProcess-__init__">__init__</a>(self,<br>
- Identifier="your_process_identifier",<br>
- Title="Your process title",<br>
- Abstract="Add optional abstract",<br>
- storeSupported="true",<br>
- ...)<br>
- <br>
-Than you can add cusom process inputs and outputs:<br>
- <br>
- <a href="#WPSProcess-AddLiteralInput">AddLiteralInput</a>(Identifier="your_input_identifier",<br>
- Title="Your input title",<br>
- type=type(0), # integers only,<br>
- ...)<br>
- <br>
- <a href="#WPSProcess-AddComplexInput">AddComplexInput</a>(Identifier="your_gml",<br>
- Title="Your gml input title",<br>
- ...)<br>
- <br>
- <br>
-And you can ofcourse define your process outputs too:<br>
- <br>
- <a href="#WPSProcess-AddLiteralOutput">AddLiteralOutput</a>(Identifier="output1",<br>
- Title="First output",<br>
- ...)<br>
- <a href="#WPSProcess-AddComplexValueOutput">AddComplexValueOutput</a>(Identifier="gmlout",<br>
- Title="Embed GML",<br>
- ...)<br>
- <br>
-At the and, you can access the values of in- and outputs with help of<br>
-GetInputValue and SetOutputValue methods:<br>
- <br>
- def execute(self):<br>
- <br>
- inputvalue = <a href="#WPSProcess-GetInputValue">GetInputValue</a>("your_input_identifier")<br>
- inputGMLFile = <a href="#WPSProcess-GetInputValue">GetInputValue</a>("your_gml")<br>
- <br>
- <a href="#WPSProcess-SetOutputValue">SetOutputValue</a>("output1", inputvalue)<br>
- <a href="#WPSProcess-SetOutputValue">SetOutputValue</a>("gmlout", inputGMLFile)<br>
- <br>
- return<br>
- <br>
-NOTE: Try to use <a href="#WPSProcess-Gcmd">Gcmd</a>("shell command") instead of os.system for<br>
- GRASS modules. It will update your self.<strong>status</strong> report<br>
- automatically, based on percentage output from GRASS modules.<br> </tt></td></tr>
-<tr><td> </td>
-<td width="100%">Methods defined here:<br>
-<dl><dt><a name="WPSProcess-AddBBoxInput"><strong>AddBBoxInput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, value<font color="#909090">=[]</font>)</dt><dd><tt>Add new input item of type BoundingBox to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-AddBBoxOutput"><strong>AddBBoxOutput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, value<font color="#909090">=[]</font>)</dt><dd><tt>Add new output item of type BoundingBoxOutput to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-AddComplexInput"><strong>AddComplexInput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, Formats<font color="#909090">=['text/xml']</font>, value<font color="#909090">=None</font>)</dt><dd><tt>Add new input item of type ComplexValue to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-AddComplexValueOutput"><strong>AddComplexValueOutput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, Formats<font color="#909090">=['text/xml']</font>, value<font color="#909090">=None</font>)</dt><dd><tt>Add new output item of type ComplexValue to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-AddComplexValueReferenceOutput"><strong>AddComplexValueReferenceOutput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, Formats<font color="#909090">=['text/xml']</font>, value<font color="#909090">=None</font>)</dt><dd><tt>Add new output item of type ComplexValueValueReference to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-AddLiteralInput"><strong>AddLiteralInput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, UOMs<font color="#909090">='m'</font>, MinimumOccurs<font color="#909090">=1</font>, allowedvalues<font color="#909090">='*'</font>, type<font color="#909090">=<type 'str'></font>, value<font color="#909090">=None</font>)</dt><dd><tt>Add new input item of type LiteralValue to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-AddLiteralOutput"><strong>AddLiteralOutput</strong></a>(self, Identifier, Title<font color="#909090">=None</font>, Abstract<font color="#909090">=None</font>, UOMs<font color="#909090">='m'</font>, value<font color="#909090">=None</font>)</dt><dd><tt>Add new output item of type LiteralValue to this process</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-Gcmd"><strong>Gcmd</strong></a>(self, cmd, stdin<font color="#909090">=None</font>)</dt><dd><tt>Runs GRASS command, fetches all GRASS_MESSAGE and<br>
-GRASS_PERCENT messages and sets self.<strong>status</strong> according to them, so<br>
-the client application can track the progress information, when<br>
-runing with Status=True<br>
- <br>
-This module is supposed to be used instead of 'os.system()', while<br>
-running GRASS modules<br>
- <br>
-Example Usage:<br>
- <a href="#WPSProcess-Gcmd">Gcmd</a>("r.los in=elevation.dem out=los coord=1000,1000")<br>
- <br>
- <a href="#WPSProcess-Gcmd">Gcmd</a>("v.net.path network afcol=forward abcol=backward out=mypath nlayer=1","1 9 12")</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-GetInput"><strong>GetInput</strong></a>(self, Identifier)</dt><dd><tt>Returns input of defined identifier</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-GetInputValue"><strong>GetInputValue</strong></a>(self, Identifier)</dt><dd><tt>Get value of selected input</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-GetOutput"><strong>GetOutput</strong></a>(self, Identifier)</dt><dd><tt>Returns output of defined identifier</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-GetOutputValue"><strong>GetOutputValue</strong></a>(self, Identifier)</dt><dd><tt>Get value of selected output</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-SetOutputValue"><strong>SetOutputValue</strong></a>(self, Identifier, value)</dt><dd><tt>Set value of selected output</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-SetStatus"><strong>SetStatus</strong></a>(self, message<font color="#909090">=None</font>, percent<font color="#909090">=None</font>)</dt><dd><tt>Sets self.<strong>status</strong> variable according to given message and<br>
-percents</tt></dd></dl>
-
-<dl><dt><a name="WPSProcess-__init__"><strong>__init__</strong></a>(self, Identifier, Title, processVersion<font color="#909090">='1.0'</font>, Abstract<font color="#909090">=''</font>, statusSupported<font color="#909090">='false'</font>, storeSupported<font color="#909090">='false'</font>)</dt></dl>
-
-</td></tr></table></td></tr></table>
-</body></html>
\ No newline at end of file
More information about the Pywps-commits
mailing list