Reading a ZIP nested inside a ZIP from an HTTP URL
Hi all,
I’m trying to read a shapefile that is stored inside a ZIP file which itself is embedded inside another ZIP. I want FME to read it directly from the download URL
However, this may not work as the server only has data.zip as a file (FME treats zips as folders). So you may need to download the zip first to a temporary location (TempPathnameCreator and HTTPCaller) then read it from the filesystem. At this point you should be able to use the syntax of c:\temp\data.zip\data2.zip\data.shp
However, this may not work as the server only has data.zip as a file (FME treats zips as folders). So you may need to download the zip first to a temporary location (TempPathnameCreator and HTTPCaller) then read it from the filesystem. At this point you should be able to use the syntax of c:\temp\data.zip\data2.zip\data.shp
@hkingsbury Thanks for your answer,
Im trying with TempPathnameCreator and HTTPCaller but it doesn’t work.
Im getting error: Shapefile reader: Failed to open file 'C:Temp\wbrun_1761808013615_1120\ fmetmp_f\1761812991049_7960_d\tor370\http_download_1761812991267_7960.bin\shp.zip' failed to open for reading. Please ensure that the file exists and that you have sufficient privileges to read it.
I’m pretty surprised this didn’t work to be honest. I tested it myself with the link and got the same result. Also with the downloaded dataset.
Seems like FME supports reading from within a zip but perhaps nested zips isn’t properly supported.
This was what I came up with - need to download the dataset and then upzip it. The ZipExtractor uses Python and can recursively unzip all zips. This is pretty nice, as you can see it’s extracted 4 shapefiles.
The Unzipper is just a FeatureReader really which will unzip the top level zip. Then you can read the shp.zip with the shapefile reader.
In the end both options work fine, The Unzipper only works for cases where the zip is one level deep but the ZipExtractor will get all file regardless of depth. This might be nice but also if you have zips you don’t want to extract then this is not ideal.
I’m pretty surprised this didn’t work to be honest. I tested it myself with the link and got the same result. Also with the downloaded dataset.
Seems like FME supports reading from within a zip but perhaps nested zips isn’t properly supported.
This was what I came up with - need to download the dataset and then upzip it. The ZipExtractor uses Python and can recursively unzip all zips. This is pretty nice, as you can see it’s extracted 4 shapefiles.
The Unzipper is just a FeatureReader really which will unzip the top level zip. Then you can read the shp.zip with the shapefile reader.
In the end both options work fine, The Unzipper only works for cases where the zip is one level deep but the ZipExtractor will get all file regardless of depth. This might be nice but also if you have zips you don’t want to extract then this is not ideal.
@virtualcitymatt Thans for answer,
both of zip extractor failed. Zip extractor error: Specified zip file or destination root folder is invalid.
Unzipper: Path Reader : Erreur lors de l'ouverture du PATH Reader sur le dossier 'C:\Users\sdt98\AppData\Local\Temp\wbrun_1761808013615_1120\fmetmp_25\1761820456082_6984_d\tor330\http_download_1761820457258_6984.bin\**'. Impossible to find folder
Maybe the temp location isn’t correctly setting?
Ahh probably just the temp data doesn't exist anymore. Try rerunning the whole workspace.
Ahh probably just the temp data doesn't exist anymore. Try rerunning the whole workspace.
Is still not working, I tried rerunning and also closing/opening the workspace and rerunning 😕
can you attache your .fmw please? I dont know why is failling
ahh sorry I’ve actaully deleted it - but I think I see where the issue is - It looks like in your httpCaller you are speficyling the downlaoded file path to be @Value(_temp_folder) but it should be @Value(_temp_folder)\data.zip
That was something I missed off from my explanation - sorry about that.
ahh sorry I’ve actaully deleted it - but I think I see where the issue is - It looks like in your httpCaller you are speficyling the downlaoded file path to be @Value(_temp_folder) but it should be @Value(_temp_folder)\data.zip
That was something I missed off from my explanation - sorry about that.
In the HttpCaller i put extension as zip file and added @Value(_temp_folder)\data.zip and works for zip extractor, but not for Unzipper
ok nice, well I can’t tell you why the Unzipper isn’t working but seems like you should be good with the ZipExtractor then.