[GRASS-dev] GRASS GIS 7 and QGIS connected using the Web Processing Service (WPS)

Moritz Lennert mlennert at club.worldonline.be
Fri Apr 15 04:48:54 EDT 2011


Hi Soeren,
[cc to Horst Düster - I'm not subscribed to the QGIS lists, trying to 
limit my flow of mails, but we can take it over there if you prefer, but 
I want to make sure that this is really a plugin problem and not my bad 
usage of your wps-grass bridge]

On 15/04/11 09:40, Moritz Lennert wrote:
> On 15/04/11 09:20, Soeren Gebbert wrote:
>> Hi Moritz,
>> the problem may be related to the QGIS WPS plugin version. The plugin
>> is still in an experimental state and under active development, but
>> the latest SVN version should be usable. Which version of the plugin
>> do you use?
>
> 0.5.

0.5.0 to be precice.

I've found the DEBUG option in the source code. Now I can see the 
request XML and the problem seems to be this (trying to launch a simple 
v.perturb on the busstopsall map of the shapefile collection of the 
nc_spm grass demo data):

<ows:Identifier>input</ows:Identifier>
<ows:Title>input</ows:Title>
<wps:Data>
<wps:ComplexData mimeType="text/xml" 
schema="http://schemas.opengis.net/gml/2.1.2/feature.xsd" 
enconding="utf-8"></wps:ComplexData>
</wps:Data>
</wps:Input>

i.e. the input data info is empty.

The same seems to be true for the output data:

<ows:Identifier>input</ows:Identifier>
<ows:Title>input</ows:Title>
<wps:Data>
<wps:ComplexData mimeType="text/xml" 
schema="http://schemas.opengis.net/gml/2.1.2/feature.xsd" 
enconding="utf-8"></wps:ComplexData>
</wps:Data>
</wps:Input>

Whereas the 'parameter' option contains the value I gave:

<wps:Input>
<ows:Identifier>parameters</ows:Identifier>
<ows:Title>parameters</ows:Title>
<wps:Data>
<wps:LiteralData>20</wps:LiteralData>
</wps:Data>
</wps:Input>


Here some info about my config:

pywps.cfg:

[grass]
path=/home/mlennert/SRC/GRASS/grass_trunk/dist.i686-pc-linux-gnu/bin:/home/mlennert/SRC/GRASS/grass_trunk/dist.i686-pc-linux-gnu/scripts
addonPath=
version=7.0svn
gui=text
gisbase=/home/mlennert/SRC/GRASS/grass_trunk/dist.i686-pc-linux-gnu
ldLibraryPath=/home/mlennert/SRC/GRASS/grass_trunk/dist.i686-pc-linux-gnu/lib
gisdbase=/home/mlennert/WWW/pywps/grassdata

pywps.cgi:

export PYWPS_CFG="/home/mlennert/WWW/pywps/pywps.cfg"
export PYWPS_PROCESSES="/home/mlennert/SRC/WPS_PROCESS"

and in WPS_PROCESSES I have all the files from your original 
wps-grass-bridge svn directory:

GlobalGrassSettings.py
GlobalGrassSettings.pyc
GrassXMLtoPyWPS.py
GrassXMLtoYAML.py
GrassXMLtoZCFG.py
PyWPSGrassModuleStarter.py

the gms and wpsXML directories (I erased the zoo-related) and a long 
list of grass modules descriptors, of which just the v.perturb one as 
example:

# ################################################ #
# This process was generated using GrassXMLtoPyWPS #
# Author: Soeren Gebbert                           #
# Mail: soerengebbert <at> googlemail <dot> com    #
# ################################################ #

from pywps.Process import WPSProcess

from PyWPSGrassModuleStarter import PyWPSGrassModuleStarter

class v_perturb(WPSProcess):

   def __init__(self):
     WPSProcess.__init__(self, identifier = 'v.perturb', title = 'Random 
location perturbations of vector points.', version = 1, statusSupported 
= True, storeSupported = True, metadata = [{'type': 'simple', 'title': 
'vector'}, {'type': 'simple', 'title': 'statistics'}], abstract = 
'http://grass.osgeo.org/grass70/manuals/html70_user/v.perturb.html')

     # Literal and complex inputs
     self.addComplexInput(identifier = 'input', title = 'Data source for 
direct OGR access', minOccurs = 1, maxOccurs = 1, formats = 
[{'mimeType': 'text/xml', 'schema': 
'http://schemas.opengis.net/gml/2.1.2/feature.xsd', 'encoding': 
'UTF-8'}, {'mimeType': 'text/xml', 'schema': 
'http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd', 'encoding': 
'UTF-8'}, {'mimeType': 'application/dgn', 'schema': 'None', 'encoding': 
'None'}, {'mimeType': 'application/shp', 'schema': 'None', 'encoding': 
'None'}, {'mimeType': 'application/x-zipped-shp', 'schema': 'None', 
'encoding': 'None'}])
     self.addLiteralInput(identifier = 'layer', title = 'A single vector 
map can be connected to multiple database tables. This number determines 
which table to use. Layer name for direct OGR access.', minOccurs = 1, 
maxOccurs = 1, type = type("string"), default = "-1")
     self.addLiteralInput(identifier = 'distribution', title = 
'Distribution of perturbation', minOccurs = 0, maxOccurs = 1, type = 
type("string"), default = "uniform", allowedValues = ['uniform', 'normal'])
     self.addLiteralInput(identifier = 'parameters', title = 'If the 
distribution is uniform, only one parameter, the maximum, is needed. For 
a normal distribution, two parameters, the mean and standard deviation, 
are required.', minOccurs = 1, maxOccurs = 1024, type = type(0.0), 
allowedValues = '*')
     self.addLiteralInput(identifier = 'minimum', title = 'Minimum 
deviation in map units', minOccurs = 0, maxOccurs = 1, type = type(0.0), 
default = 0.0)
     self.addLiteralInput(identifier = 'seed', title = 'Seed for random 
number generation', minOccurs = 0, maxOccurs = 1, type = type(0), 
default = 0)

     # complex outputs
     self.addComplexOutput(identifier = 'output', title = 'Name for 
output vector map', formats = [{'mimeType': 'text/xml', 'schema': 
'http://schemas.opengis.net/gml/2.1.2/feature.xsd', 'encoding': 
'UTF-8'}, {'mimeType': 'text/xml', 'schema': 
'http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd', 'encoding': 'UTF-8'}])

   def execute(self):
     starter = PyWPSGrassModuleStarter()
     starter.fromPyWPS("v.perturb", self.inputs, self.outputs, self.pywps)

if __name__ == "__main__":
   process = v_perturb()
   process.execute()

Any ideas ?

Moritz


>> 2011/4/14 Moritz Lennert<mlennert at club.worldonline.be>:
>>> Soeren,
>>>
>>> Thanks for the great work on WPS integration !
>>>
>>> On 28/01/11 11:44, Soeren Gebbert wrote:
>>>>
>>>> How to attach GRASS modules to PyWPS using the wps-grass-bridge is
>>>> documented here:
>>>> http://code.google.com/p/wps-grass-bridge/wiki/PyWPS_Integration
>>>>
>>>> Well, the code isn't stable yet but it demonstrates the possibilities
>>>> of this approach.
>>>
>>> I've tried following the above instructions, and the server does give a
>>> correct answer for GetCapabilities. I can also see the list of
>>> modules in
>>> the QGIS WPS plugin and get the GUI of a module. However, once I run the
>>> module I always get the following error, whatever the module I try:
>>>
>>> <wps:ProcessFailed>
>>> <wps:ExceptionReport>
>>> <ows:Exception exceptionCode="NoApplicableCode">
>>> <ows:ExceptionText>argument 1 must be string or buffer,
>>> not None</ows:ExceptionText>
>>> </ows:Exception>
>>> </wps:ExceptionReport>
>>> </wps:ProcessFailed>
>>>
>>>
>>> Any idea what could be wrong ? I can't find a way to see what URL the
>>> QGIS
>>> plugin sends to the server.
>>>
>>> Moritz
>>>
>>>
>
>
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev



More information about the grass-dev mailing list