Note that there are some explanatory texts on larger screens.

plurals
  1. POrgdal / readOGR - unable to read shapefile from .zip
    text
    copied!<p>I'm trying to load a zip level shapefile to do some plotting, per: <a href="https://github.com/hadley/ggplot2/wiki/plotting-polygon-shapefiles">https://github.com/hadley/ggplot2/wiki/plotting-polygon-shapefiles</a> http://www.nceas.ucsb.edu/scicomp/usecases/ReadWriteESRIShapeFiles etc</p> <p>My code:</p> <pre><code>library(rgdal) library(RColorBrewer) library(ggplot2) zipmap = readOGR(dsn="file.zip/", layer="myZIPmap") </code></pre> <p>I'm getting this error:</p> <pre><code>Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding = input_field_name_encoding) : Cannot open file </code></pre> <p>I checked the drivers but to be honest am not able to interpret the output:</p> <pre><code>ogrDrivers() name write 1 AeronavFAA FALSE 2 ARCGEN FALSE 3 AVCBin FALSE 4 AVCE00 FALSE 5 BNA TRUE 6 CSV TRUE 7 DGN TRUE 8 DXF TRUE 9 EDIGEO FALSE 10 ESRI Shapefile TRUE 11 Geoconcept TRUE 12 GeoJSON TRUE 13 Geomedia FALSE 14 GeoRSS TRUE 15 GML TRUE 16 GMT TRUE 17 GPSBabel TRUE 18 GPSTrackMaker TRUE 19 GPX TRUE 20 HTF FALSE 21 Idrisi FALSE 22 KML TRUE 23 MapInfo File TRUE 24 Memory TRUE 25 MSSQLSpatial TRUE 26 ODBC TRUE 27 OpenAir FALSE 28 PCIDSK TRUE 29 PDS FALSE 30 PGDump TRUE 31 PGeo FALSE 32 REC FALSE 33 S57 TRUE 34 SDTS FALSE 35 SEGUKOOA FALSE 36 SEGY FALSE 37 SUA FALSE 38 SVG FALSE 39 TIGER TRUE 40 UK .NTF FALSE 41 VFK FALSE 42 VRT FALSE 43 XPlane FALSE </code></pre> <p>file.info gives:</p> <pre><code> file.info(path="K:/2012 - IPD - Policy Maps/fe_2007_us_zcta500.zip/") size isdir mode mtime ctime K:/2012 - IPD - Policy Maps/fe_2007_us_zcta500.zip/ 661131516 FALSE 666 2012-08-22 14:54:53 2012-08-22 14:50:43 atime exe K:/2012 - IPD - Policy Maps/fe_2007_us_zcta500.zip/ 2012-08-22 14:58:38 no </code></pre> <p>Given the internet searches I've tried, it looks like I'm not the only one having this issue but I've been unable to find an answer. I'm not sure if the problem is related to the shapefile being inside a .zip folder or not. As it's a work computer, I have to wait for IT to install WinZip so that I can extract the shapefile and try outside a .zip folder. Hopefully that will be tomorrow. </p> <p>Also, the package help states "Note that stray files in data source directories (such as *.dbf) may lead to suprious errors that accompanying *.shp are missing." The .zip folder has the following: a.dbf, b.prj, c.shp, d.shp.xml, e.shx.</p> <p>Any help you can provide would be wonderful! -Alex</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload