Replies: 2 comments
-
Would you belive it: I actually had my path wrong on disk, even before the first zip file. 😊 When I fixed that, the code above works! I'm going to leave it here because I can find precious little on using this I'd still be interested to hear if it's possible to pass Fiona several different bytes-like objects representing the various sidecars and have it read them all. |
Beta Was this translation helpful? Give feedback.
-
@nk9 I've never needed to work with nested zip files. I'm not surprised that multiple /vsizip/ works despite lack of documentation. Distributing data as nested zip files seems like a bad idea to me. I wouldn't want Fiona to explicitly support them and thus propagate the practice. |
Beta Was this translation helpful? Give feedback.
-
I have a nested zip that looks like this:
I couldn't really figure out how to use
ZipMemoryFile
with this setup; the nesting is doing my head in. I actually have code to pull out all the.{shp,dbf,prj}
files from the level3 zip using nested calls to Python'szipfile
built-in module, so if I could find a way to just hand all three to Fiona as bytes, then I'd be off to the races. I'm transitioning from pyshp; there, you can just doshapefile.Reader(dbf=zip.open('path.dbf'), prj=zip.open('path.prj'), shp=zip.open('path.shp'))
. If something like this is possible, that would be great.In searching for a solution, I found GDAL's
/vsizip/
syntax. It actually SEEMS not crazily complex, and purports to do exactly what I want. This post gave me hope… So I tried this:But no dice:
Should this work, or am I doing something wrong?
It's a little less robust than the first approach, because I'm assuming that the file structure inside doesn't change. I'd really prefer the first way, recursively listing things and then passing all the necessary files opened in memory to fiona.
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions