WPSClient - Luís de Sousa
-
Upload
luisdesousa -
Category
Documents
-
view
469 -
download
2
description
Transcript of WPSClient - Luís de Sousa
WPSClient - A client for assynchronousinteraction with WPS written in Python
Luıs de Sousa, Christian Braun, Chris Eykamp, Ulrich Leopold,Olivier Baume and Rui Martins
Public Research Centre Henri Tudor,Esch-sur-Alzette, Luxembourg.
WPS technologies forIntegrated Assessment Modelling in Urban Areas WorkshopJanuary, 22-24 2014, Belval, Luxembourg
www.tudor.lu
Requirements
A generic application
I A seamless WPS client to be used by a Web Server;
I A generic approach - unawere of databases or clientspecificities;
I Send assynchronous process requests;
I Check process status;
I Retrieve results;I Publish geospatial results to a MapServer instance:
I Vector layers available as WMS and WFS;I Raster layers available as WMS and WCS;I All layers available in EPSG:3857 plus native CRS.
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 2
Design options
I PythonI GDAL/OGR library;I MapScrit library;I Results processing similar to inputs processing in PyWPS;I Performance not crucial.
I Pre-configuarations (not available as application inputs):I MapServer setup;I Aditional CRS;I Fle system locations.
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 3
Difficulties
I Sending requests through HTTP POSTI Required to pass long URLs to WCS and WFS resources;I Thin documentation, few examples available;I Output names must be known in advance.
I MapScriptI No methods available to set up WFS or WCS;I Thinly documented;I Python library hard to read.
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 4
The Map file
A text based generator
I Inelegant code.
I Totally dependent on the Map file syntaxe.
I First version developed in hours.
I Easy to maintain and evolve.
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 5
Examples of usage
Starting a process
>>> import WPSClient
>>> myCli = WPSClient.WPSClient()
>>> myCli.init(
... "http://wps.iguess.tudor.lu/cgi-bin/pywps.cgi?",
... "slope_aspect",
... ["dem"],
... ["http://maps.iguess.tudor.lu/cgi-bin/mapserv?map=/srv/mapserv/MapFiles/RO_localOWS_test.map
&SERVICE=WCS&FORMAT=image/img&CRS=EPSG:28992&BBOX=92221,436692,92306,436769
&RESX=0.5&RESY=0.5&VERSION=1.0.0&REQUEST=getCoverage&COVERAGE=ro_dsm"],
... ["slope", "aspect"],
... ["slope_result", "aspect_result"])
>>> url = myCli.sendRequest()
>>> print url
http://wps.iguess.tudor.lu/wpsoutputs/pywps-020cc26a-7f92-11e3-a8a7-005056a52e0d.xml
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 6
Examples of usage
Checking process status>>> myCli = WPSClient.WPSClient()
>>> myCli.initFromURL(url, ["slope", "aspect"], ["slope_result", "aspect_result"])
>>> status = myCli.checkStatus()
>>> print status
True
>>> print myCli.statusMessage
None
Retrieving results>>> myCli = WPSClient.WPSClient()
>>> myCli.initFromURL(url, ["slope", "aspect"], ["slope_result", "aspect_result"])
>>> status = myCli.checkStatus()
>>> print status
True
>>> myCli.epsg = "3035"
>>> myCli.generateMapFile()
DEBUG:WPSClient:Generated layer slope of type raster.
DEBUG:WPSClient:Generated layer aspect of type raster.
INFO:WPSClient:Wrote map file to disk:
/var/www/tmp/pywps-4d87fa24-7f93-11e3-8b10-005056a52e0d.map
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 7
Future work
I Test with other WPS servers.
I Separate the Map file generator as a sub-module - reusable inother projects.
I Proper XML parsing?
I WPS 2.0 ?
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 8
Thank you
Fork it!
https://github.com/iguess/wpsclient
WPS technologies for Integrated Assessment Modelling in Urban Areas Workshop January, 22-24 2014, Belval, LuxembourgWPSClient - A client for assynchronous interaction with WPS written in Python 9