[Gdal-dev] Read shapefile from zip with python and OGR

Sean Fulton seanasy at gmail.com
Sun Jul 22 00:02:10 EDT 2007


I'd like to open a zip file with python and read a shapefile within the 
zip with OGR.  Some thing like this:

import zipfile, ogr

zip = zipfile.ZipFile('Zoning.zip', 'r')
shape = zip.read('Zoning.shp')
data=ogr.Open(shape)

The above doesn't work. Is it because the shapefile driver needs access 
to the other files (.shx, .prj, .sbx, .dbf)? Is there a way to load 
them all manually?

Thanks,

Sean







More information about the Gdal-dev mailing list