In Python, How to Encoding and Decode Complex Data for a OWSLib WPS call to PyWPS-4?

المشرف العام

Administrator
طاقم الإدارة
In Python, how can I encode "complex" (vector) data for a WPS call that just echos back the data, and decode the data from the result. I was planning on using OWSLib on the client side and PyWPS-4 on the server side.

This is what I have so far:

import owslib.wpsimport osgeo.ogr#create the connection to the PyWPS-4 Serverwps = owslib.wps.WebProcessingService('http://127.0.0.1:5000/wps', version="1.0.0", verbose=True, skip_caps=True)# Create a geometry collectiongeomcol = osgeo.ogr.Geometry(osgeo.ogr.wkbGeometryCollection)# Add a pointpoint = osgeo.ogr.Geometry(osgeo.ogr.wkbPoint)point.AddPoint(-122.23, 47.09)geomcol.AddGeometry(point)# Add a second pointpoint = osgeo.ogr.Geometry(osgeo.ogr.wkbPoint)point.AddPoint(-122.60, 47.14)geomcol.AddGeometry(point)#Format and Make WPS Callprocessid = "echo_test"inputs = [("layer", ComplexData(geomcol))]execution = wps.execute(processid, geomcol.ExportToGML())#Extract data from call#???This doesn't work because the geometry should be an XML object not a string, but I get the following error if I try converting the GML to XML:

>>> lxml.etree.fromstring(geom.ExportToGML())XMLSyntaxError: Namespace prefix gml on MultiGeometry is not definedAlso, I have no idea how to extract back out the data once it is echoed back.

Thank you.



أكثر...
 
أعلى