Discussion:
[Community] wfs
manuele
2011-03-23 15:56:32 UTC
Permalink
Hi *,
I'm new user interested in finding a python client library for wfs.
OWSLib sounds pretty good but few documentation or tutorial are
available on line. In particular at the moment I'm interested in connect
to wfs servise get feature and save it locally in some usefull formats
such as shape file for example. can somebody help me please?

I've seen that xml is easily obtained from wfs feature type saving it in
text file after using getFeature method simply reading the object
obtained as a file; something like:

featureILike = wfs.getFeature(typename=['<myTypeName>'], \
bbox=(<xi>, <yi>, <xf>, <yf>))
out = open('<pathToMyFile>', 'wb')
out.write(featureILike.read())
out.close()

is there a way via python to convert it in shape file for example? or
better to upload it in a PostGis table?

thank you very much

regards

Manuele
Paolo Corti
2011-03-23 16:31:32 UTC
Permalink
Post by manuele
I've seen that xml is easily obtained from wfs feature type saving it in
text file after using getFeature method simply reading the object obtained
featureILike = wfs.getFeature(typename=['<myTypeName>'], \
? ? ? ?bbox=(<xi>, <yi>, <xf>, <yf>))
out = open('<pathToMyFile>', 'wb')
out.write(featureILike.read())
out.close()
is there a way via python to convert it in shape file for example? or better
to upload it in a PostGis table?
Hi Michele
you definitely need another library in order to serialize geometries
in different formats (like shapefile or PostGIS).
You may give a try to the GDAL Python bindings or to the GeoDjango
GDAL API, and use these in conjunction with OWSLib.

But before writing any code: have you tried to use the GDAL ogr2ogr
utility with the WFS driver?

ciao
P
--
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @paolo_corti
Loading...