I've created a python wps service in the zoo-project framework, which is used to calculate a Line of Sight based in on a start point, an end point and a start point height. The service works fine if i send a URL like the following:<gml:Point><gml:coordinates>711330,6197923</gml:coordinates></gml:Point>;endpoint=<gml:Point><gml:coordinates>711370,6197970</gml:coordinates></gml:Point>;height=20&Version=1.0.0&

I want to get the wps to work with qgis, but after connecting using the WPS-Client plug-in I first got an error saying that the inputs had to be gml (it was originally geojson). After changing my datatype to gml, as in:

 mimeType = text/xml
 encoding = UTF-8
 schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd

it still doen't work. I can't choose a GML layer, which is in the layers panel as input, but I can chose a newly created scratch layer.

Unfurtunately when choosing the scratch layer i get the following error: the error I get in qgis when running my process

In my function I use psycopg2 to connect to a db and input a point as gml into the ST_GeomFromGML function

Anyone have an idea to where I'm failing?


There is no way to specify in the ZCFG that you want to use both cases. With the WPSClient you are using now, you should have a file in your /tmp/ directory containing the request sent to your server. You should have a look at it and see what is its content. It should contain a full GML Feature Collection containing a single feature. Nevertheless, your service handles only one GML feature so part of the input provided by QGIS WPSClient. In your service's source code, you may verify the first node. You may also find inspiration in the OGR service's source code available from here. In this source code, we first try to load a geometry feature from GML (in case it is only a feature rather than a feature collection), if it failed we try to load a feature collection. It is exactly the same situation in your case you should verify the exact same thing.

Note that I am surprised a lot by the issue about password too.

  • I've looked into the /tmp folder and found the full request to my WPS, and as you said, it contains a full GML FeatureCollection with just one member. I haven't found a way to extract the point from the collection using python yet, but I can see how it should work. Thanks for the answer Gérald – JonasPedersen Apr 19 '16 at 12:47
  • In the function createGeometryFromWFS available in the file: zoo-project/zoo-services/ogr/base-vect-ops-py/cgi-env/ogr_sp.py we are using OGR for that purpose. – Gérald Fenoy Apr 19 '16 at 15:58
  • Yes, I looked at that. Tried doing it like this: ogr.CreateGeometryFromGML(inputs["startpoint"]["value"]), but without success. – JonasPedersen Apr 19 '16 at 16:11
  • You may try using the readFileFromBuffer function to parse a FeatureCollection. Then, you will have to access the geometry of the feature from the collection. – Gérald Fenoy Apr 20 '16 at 10:28

I suppose that it comes from the fact that your inputs are not real GML Feature data but part of it, you use only the geometry node. If you change your code to treat both cases (or you change your request to use the GML Feature) then you will succeed in running your service from both QGIS WPS client and from your browser.

In case it is of any help, we have an updated version of the WPS Client available from here http://geolabs.fr/plugins.xml .

  • Can you specify how I can change my .zcfg (I guess that's where I would need to change things) to accept both cases? I will try the version of the WPSclient that you linked to. Thanks – JonasPedersen Apr 18 '16 at 8:32
  • When running the WPS through GeoLabs QgsWPSClient I get a response in the UI that the process is running and finishes. The Output in /var/www/tmp/ are an .xml, a .json and a error.log file. The xml contains : <ows:Exception exceptionCode="InternalError"> <ows:ExceptionText>ZOO Kernel failed to process your request, receiving signal 11 = SIGSEGV</ows:ExceptionText> and the .log contains 'ERROR 1: PQconnectdb failed. fe_sendauth: no password supplied'. The .json is empty. I don't get the password thing, as is works from the browser. – JonasPedersen Apr 18 '16 at 10:10
  • You have compiled the ZOO-Kernel to use PostgreSQL as a backend but never setup the database probably as it is not able to connect to the database server, this should be done following this instructions: zoo-project.org/docs/install/…. You should make sure to setup also the zoo-service/utils/status to have the up-to-date status available. Indeed, in this version of the QGIS plugin, every request has been sent using asynchronous execution, so status can be polled within the plugin and the progress bar displayed. – Gérald Fenoy Feb 2 '17 at 11:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.