Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

As far as I understand WPS (web processing service) can be used to execute geospatial operations on the server side.

Is it possible to create scripts with WPS?

For example something like: 'check in a directory if there is a new file' - if so , 'process this file', 'store the result in the database'

I assume that I'm expecting too much, but what is the best solution for an script when using qgis server or geoserver?

D3

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

WPS is a stateless technology - you give it a process to execute (by HTTP GET or POST), and after some time, it gives you some sort of result. This may be a bit of XML or JSON, a link to an image, or the image itself.

On the server side, someone will have written one or more processes, detailing the expected inputs and the given outputs. The language these are written in are transparent to you the user. In the case of pyWPS they'll be written in Python. With the ZOO-project, it can be in one of a multitude of languages. But each process is completely standalone from any other process. Also, there is no standard set of processes that have to be created - so you are entirely at the whim of the WPS server you are connected to.

So the upshot is, the general way you as a user interact with a WPS is to chain processes together, and issue them in sequence via some sort of script. This could be some Javascript that makes successive execute requests, or a workflow system such as Taverna (see here for pyWPS working with Taverna). This is better than having monolithic processes on the server side because you keep nice small independent processes than can be chained in multiple ways rather than having to provide lots of parameters to control a process - and that's assuming you have access to the server in the first place. In addition, you could spread WPS servers over multiple machines, each one dedicated to a subset of processes which reduces server load, and provides possible parallelisation.

share|improve this answer
add comment

What about a script to make the WPS call at a predefined interval? Or a shell script that, when a change occurs in the directory, it makes a localhost WPS call? Alternatively, I would suggest that your workflow could run totally local and push the result to your DB.

One potential workflow:

  1. New file added to a directory.
  2. Shell script fires which calls a python script to perform the processing, load the result into the database, and load the result into GeoServer.
  3. OpenLayers parses potential available layers via JSON, instead of hard coding them, and on page reload sees that a new data layer is available. The reload could be avoided using something like jQuery to allow asynchronous communication.

Is that the kind of functionality you are trying to achieve?

share|improve this answer
add comment

There is a community module that offers a scripting interface in different languages.

http://docs.geoserver.org/stable/en/user/community/scripting/index.html

Including a WPS hook that allows you to add new processes via script. Currently there are only builds available for Python:

http://gridlock.opengeo.org/geoserver/2.2.x/community-latest/

I've been meaning to add a build for the javascript language, and I believe the groovy one is in the works.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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