38
PyWPS – Project status and demo achym ˇ Cepick´ y 1 1 Geosense s.r.o. http://geosense.cz WPS Workshop

PyWPS at COST WPS Workshop

Embed Size (px)

Citation preview

Page 1: PyWPS at COST WPS Workshop

PyWPS – Project status and demo

Jachym Cepicky1

1Geosense s.r.o. http://geosense.cz

WPS Workshop

Page 2: PyWPS at COST WPS Workshop

Jachym Cepicky

ForesterOpenSource GIS developer (formeruser) - GRASS, OpenLayers, PyWPS,. . .Member of Board of directors of OpenSource Geospatial Foundation(OSGeo.org)@jachymc http://les-ejk.czhttp://www.openstreetmap.org/user/jachymc

Page 3: PyWPS at COST WPS Workshop

TOC

1 About PyWPS

2 Code

3 PyWPS 4

Page 4: PyWPS at COST WPS Workshop

What is PyWPS

OGC WPS on the ServerSince 2006Pythonhttp://pywps.wald.intevation.org

http://github.org/geopython/pywps

Page 5: PyWPS at COST WPS Workshop

PyWPS - what it is NOT

PyWPS is no analytical tool or engine. It does not performany type of geospatial calculation.PyWPS is not special XML parser or generator. It does notvalidate your GMLs against given schemas (yet), it doesnot build GML from Python objects.It is not complicated

Page 6: PyWPS at COST WPS Workshop

PyWPS - what it is NOT

PyWPS is no analytical tool or engine. It does not performany type of geospatial calculation.PyWPS is not special XML parser or generator. It does notvalidate your GMLs against given schemas (yet), it doesnot build GML from Python objects.It is not complicated

Page 7: PyWPS at COST WPS Workshop

PyWPS - what it is NOT

PyWPS is no analytical tool or engine. It does not performany type of geospatial calculation.PyWPS is not special XML parser or generator. It does notvalidate your GMLs against given schemas (yet), it doesnot build GML from Python objects.It is not complicated

Page 8: PyWPS at COST WPS Workshop

Keywords

Page 9: PyWPS at COST WPS Workshop

Keywords

rather bike, then a car

Page 10: PyWPS at COST WPS Workshop

Keywords

#small

Page 11: PyWPS at COST WPS Workshop

Keywords

#modular

Page 12: PyWPS at COST WPS Workshop

Keywords

#fast

Page 13: PyWPS at COST WPS Workshop

Keywords

#easy

Page 14: PyWPS at COST WPS Workshop

Keywords

#slick

Page 15: PyWPS at COST WPS Workshop

Keywords

#accessories (GRASS, GDAL, Shapely, #python)

Page 16: PyWPS at COST WPS Workshop

History of PyWPS

2006-11-10 version 1.0.0 Web User Interface for WPS(Embrio).

2007-10-08 version 2.0.0 New version improved stability,Process class, OpenLayers 2.x.

2008-11-06 version 3.0.0 New code structure, implementationof WPS 1.0.0

2009-06-01 version 3.1.0 New generic JavaScript WPS Clientlibrary and more.

2011-09-06 version 3.2.0 MapServer2013 Moved to GitHub

http://github.com/geopython/pywps

2013-5 FOSS4G-CEE 2013, Bucharest, Started to workon PyWPS-4

Page 17: PyWPS at COST WPS Workshop

How does it work

Time machine / climate change model

Page 18: PyWPS at COST WPS Workshop

How does it work

Internet, sharing

Page 19: PyWPS at COST WPS Workshop

How does it work

Page 20: PyWPS at COST WPS Workshop

How does it work

Page 21: PyWPS at COST WPS Workshop

How does it work

Page 22: PyWPS at COST WPS Workshop

How does it work

One process

Page 23: PyWPS at COST WPS Workshop

How does it work

Two processes

Page 24: PyWPS at COST WPS Workshop

How does it work

Process chain

Page 25: PyWPS at COST WPS Workshop

TOC

1 About PyWPS

2 Code

3 PyWPS 4

Page 26: PyWPS at COST WPS Workshop

Talk is cheap. Show me the code

1 from pywps.Process import WPSProcess2 from osgeo import ogr3 import types4 [...]5 WPSProcess.__init__(self,6 identifier = "ogrbuffer", # must be same, as filename7 title="Buffer process using OGR")8 [...]9 self.data = self.addComplexInput(identifier = "data")10 self.size = self.addLiteralInput(identifier="size")11 self.output =self.addComplexOutput(identifier="buffer")

Page 27: PyWPS at COST WPS Workshop

Talk is cheap. Show me the code

1 from pywps.Process import WPSProcess2 from osgeo import ogr3 import types4 [...]5 WPSProcess.__init__(self,6 identifier = "ogrbuffer", # must be same, as filename7 title="Buffer process using OGR")8 [...]9 self.data = self.addComplexInput(identifier = "data")10 self.size = self.addLiteralInput(identifier="size")11 self.output =self.addComplexOutput(identifier="buffer")

Page 28: PyWPS at COST WPS Workshop

Talk is cheap. Show me the code

1 from pywps.Process import WPSProcess2 from osgeo import ogr3 import types4 [...]5 WPSProcess.__init__(self,6 identifier = "ogrbuffer", # must be same, as filename7 title="Buffer process using OGR")8 [...]9 self.data = self.addComplexInput(identifier = "data")10 self.size = self.addLiteralInput(identifier="size")11 self.output =self.addComplexOutput(identifier="buffer")

Page 29: PyWPS at COST WPS Workshop

Talk is cheap. Show me the code

10 def execute(self):1112 inSource = ogr.Open(self.data.getValue())13 inLayer = inSource.GetLayer()1415 [...]16 outLayer = outSource.CreateLayer(17 out,None,ogr.wkbUnknown)1819 [...]

20 while index < featureCount:21 self.status.set("Calculating buffer for feature %d from %d" % (index+1,featureCount),22 (100*(index+1)/featureCount*1.0))23 [...]24 inGeometry = inFeature.GetGeometryRef()2526 # make the buffer27 buff = inGeometry.Buffer(float(self.size.getValue()))2829 [...]30 self.output.setValue(out)31 return

Page 30: PyWPS at COST WPS Workshop

Talk is cheap. Show me the code

10 def execute(self):1112 inSource = ogr.Open(self.data.getValue())13 inLayer = inSource.GetLayer()1415 [...]16 outLayer = outSource.CreateLayer(17 out,None,ogr.wkbUnknown)1819 [...]

20 while index < featureCount:21 self.status.set("Calculating buffer for feature %d from %d" % (index+1,featureCount),22 (100*(index+1)/featureCount*1.0))23 [...]24 inGeometry = inFeature.GetGeometryRef()2526 # make the buffer27 buff = inGeometry.Buffer(float(self.size.getValue()))2829 [...]30 self.output.setValue(out)31 return

Page 31: PyWPS at COST WPS Workshop

What can be connected

Python* (GDAL/OGR, GRASS, MapServer, Shapely, Fiona, R, PostGIS, . . . )

Jython - Java* (GeoTools, JTS, GeoServer, . . . )

Any batch file

Page 32: PyWPS at COST WPS Workshop

Tools, which are tested with PyWPS

GRASS (GRASS-WPS interface, Soren Gebert)

R

Taverna (WPS-WSDL orchestration, Jorge de Jesus)

MapServer (output generation using OGC OWS, still concept)

Page 33: PyWPS at COST WPS Workshop

TOC

1 About PyWPS

2 Code

3 PyWPS 4

Page 34: PyWPS at COST WPS Workshop

Bright future

Started from scratch

Use Python 2.7 (for future 3.0 migration)

Try different interpreters of Python (pypy)

Easy parsing with lxml

Prepare for next WPS version

Change of the whole process concept

Page 35: PyWPS at COST WPS Workshop

PyWPS 4

#geopython 2006

Page 36: PyWPS at COST WPS Workshop

PyWPS 4

#geopython 2013

Page 37: PyWPS at COST WPS Workshop

lxml http://lxml.org

GRASS-WPS, GRASS-Python

Werkzeug http://werkzeug.pocoo.org/

Python 3

Django

MapServer for output generation

Respect to new OGC WPS 2.0.0 features

. . .

Page 38: PyWPS at COST WPS Workshop

Happy processing!

[email protected]://les-ejk.cz@jachymc

http://github.org/jachym/pywps-4http://pywps.wald.intevation.org