I'm trying to write a Script, which will download an entire WFS layer to Disk. The output format could be GeoJSON, Spatilite or even Shapefile.
I know how to do this using ogr2ogr
, but I need to use the Python Bindings, since this is part of a larger Python script.
How do I download the entire layer using the GDAL bindings?
I've managed to write the following code:
import sys
from osgeo import ogr
driver=ogr.GetDriverByName('WFS')
url=sys.argv[3]
layerName=sys.argv[4]
wfs=driver.Open('WFS:'+url)
layer=wfs.GetLayerByName(layerName)
#I'm stuck here
#I need to save this entire Layer to disk, in any format that GDAL understands