Implementing WPS client in OpenLayers 3?

As part of the WPS-GUI project that I did I created a WPS client "library" that closely models after the OpenLayers 2 interface. It uses JSONIX (http://confluence.highsource.org/display/JSNX/Jsonix) for the all OGC XML marshalling and unmarshalling.

You can check it out here:

https://github.com/boundlessgeo/wps-gui/blob/master/src/wpsclient.js


I also reused the openlayers 2 client in a wps builder. I did have to implement the DefaultValue and ExecuteResponse objects.

There is some wider need for a mapping client independent wps client, as seen in this discussion on working towards a ows.js (based on jsonix, like @bartvde's implementation). Since that discussion work has started. The WPS implementation has not started yet. The idea of javascript ows.js is modelled after the convenient owslib library.

The main challenges in implementing a WPS client are:

  • defining the xml to object mapping. That's the role of jsonix and the OpenLayers (2) format readers.
  • defining a convenient api for executing requests. If you look at the owslib wps implementation as an example you'll see that implementing a convenient api for the WPS processes is not a trivial task. The wide variety of options (with/without status, raw response/reference response, etc...) make supporting all possible in- and outputs quite a challenge.

One possibility is to use the wps client from openlayers 2 in your openlayers 3 project. The response from the wps request is in WKT and you can easily format this to a openlayers 3 feature with the built in formatter.

http://openlayers.org/en/v3.9.0/apidoc/ol.format.WKT.html

(The response depending on what wps request you are using of course..)

I did this in a project as I did not have time to implement my own wps client.