Skip to main content
Question

Reading from a zip file


fmelizard
Contributor
Forum|alt.badge.img+17
Hi List,

 

I have a zip file (Ordnance Survey Strategi) that I am trying to read directly from the zip.

 

 

If I try adding it as a new shapefile reader:

 

|WARN  |SHAPE Reader: Dataset `D:/FME_TEMP/Strategi - jan 2013.zip_1367490110324_26520/STRATEGI_README.TXT' lacks the required extension `shp'

 

|INFORM|Merged 0 schema features read from 1 datasets into 0 resulting feature types

 

|INFORM|Opened mapping File D:\\FME_TEMP\\FME_1367490109473_18168.fmw for output

 

|INFORM|Mapping File Generation was SUCCESSFUL

 

|INFORM|FME Session Duration: 4.2 seconds. (CPU: 2.1s user, 0.6s system)

 

|INFORM|END - ProcessID: 26520, peak process memory usage: 40580 kB, current process memory usage: 40212 kB

 

Mapping File Generation was SUCCESSFUL

 

 

If I try it from a generic reader that is already in the project (and has been set to with the "input Format" as SHAPE  I get: 2013-05-02 11:26:09|   3.8|  0.1|ERROR |SHAPE Reader: Dataset `D:\\FME_TEMP\\Strategi - jan 2013.zip_1367490365305_30088\\STRATEGI_README.TXT' lacks the required extension `shp'

 

2013-05-02 11:26:09|   3.8|  0.0|ERROR |Error opening the SHAPE Reader on dataset `D:\\FME_TEMP\\Strategi - jan 2013.zip_1367490365305_30088\\STRATEGI_README.TXT'

 

2013-05-02 11:26:09|   3.8|  0.0|INFORM|Closing the GENERIC Reader

 

2013-05-02 11:26:09|   3.8|  0.0|ERROR |Fatal error encountered.  (See the logfile messages.)

 

If I turn off the input format and set it back to "GENERIC", it reads one text file out of it.

 

 

Either way, it seems to be failing quite badly.

 

 

Am I doing something wrong, or can the zip reader not walk through directories within a zip file?

 

 

Thanks,

 

Jonathan

3 replies

fmelizard
Contributor
Forum|alt.badge.img+17
  • Author
  • Contributor
  • May 2, 2013
Ok, so it seems the solution is that you have to go into the "Directories" thing and tick the "subdirectories" checkbox.

 

 

Makes sense, but its not obvious - the zip is accessed using the single-file interface after all which doesn't have a "subdirectories" checkbox.

 

 

Also - what happens if I have multiple zipfiles in a directory structure and want to walk through the subdirectories to get at the zip files but not walk through the zip file subdirectories?

 

 

Surely there should be a seperate option for walking through zip-subdirectories?

david_r
Evangelist
  • May 2, 2013
Hi Jonathan,

 

 

a zip file contains its own file system, and in FME it behaves like a normal directory (with subdirectories, if any) inside its containing folder.

 

 

If you need to walk through zip files in a single directory, you could e.g. use the "Directory and file pathnames" reader first, then passing the results onto a FeatureReader.

 

 

David

  • September 2, 2015
This error may also be thrown if you run out of disk space such that the contents of the ZIP archive cannot be extracted, and hence the .shp file is not found. Frustrating error reporting.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings