[R-sig-Geo] Problems reading shapefiles in R

Roger Bivand Roger.Bivand at nhh.no
Sun Apr 10 21:15:51 CEST 2011


On Sun, 10 Apr 2011, Felipe Carrillo wrote:

> Manuel:
> As a test, delete the rgeos package from your library and run one of the
> commands again. You can always install the package back if you need it.

Please do not give unmotivated advice on the list, as it will mislead. 
There is no interaction between rgeos and functions for reading vector 
objects - if you believe otherwise, please report this with a reproducible 
case. Bad advice is worse than no advice.

The obvious place to check is:

list.files(path="C:/ProyectosRespacial/ICE/SIG_Biotica_PHED",
   pattern="AI_BIOTICA_010411_CRTM05")

which must show at least:

"AI_BIOTICA_010411_CRTM05.dbf" "AI_BIOTICA_010411_CRTM05.shp" 
"AI_BIOTICA_010411_CRTM05.shx"

for "AI_BIOTICA_010411_CRTM05" to be a shapefile. The error messages show 
that "AI_BIOTICA_010411_CRTM05.dbf" is missing, so please check that it is 
present first.

Hope this clarifies,

Roger

>  
> Felipe D. Carrillo
> Supervisory Fishery Biologist
> Department of the Interior
> US Fish & Wildlife Service
> California, USA
> http://www.fws.gov/redbluff/rbdd_jsmp.aspx
>
>
>
>
> ----- Original Message ----
>> From: Manuel Spínola <mspinola10 at gmail.com>
>> To: r-sig-geo at r-project.org
>> Sent: Sun, April 10, 2011 9:54:20 AM
>> Subject: [R-sig-Geo] Problems reading shapefiles in R
>>
>> Dear list members,
>>
>> I am trying to read a shapefile in R using 3 different methods and all of
>> them failed:
>>
>>> ai_biotica <- readOGR(dsn="C:/ProyectosRespacial/ICE/SIG_Biotica_PHED",
>> layer="AI_BIOTICA_010411_CRTM05")
>> Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding =
>> input_field_name_encoding) :
>>
>>         GDAL Error 4: Unable to open
>> C:/ProyectosRespacial/ICE/SIG_Biotica_PHED\carretera_interamericana_CRTM05.shx
>> or
>>
> C:/ProyectosRespacial/ICE/SIG_Biotica_PHED\carretera_interamericana_CRTM05.SHX.
>>
>>> nc1 <-
>> readShapePoly("C:/ProyectosRespacial/ICE/Shapefiles/AI_BIOTICA_010411_CRTM05.shp",
>> ,
>> proj4string=CRS("+proj=tmerc +lon_0=-84 +lat_0=0 +x_0=500000 +k=0.9999
>> +datum=WGS84"))
>> Error in read.dbf(filen1) : unable to open DBF file
>>
>>
>>> ai_biotica <- readShapeSpatial("AI_BIOTICA_010411_CRTM05")
>> Error in read.dbf(filen1) : unable to open DBF file
>>
>> I will appreciate any input on the problem.
>>
>> Best,
>>
>> Manuel Spínola
>>
>>
>>
>> --
>> *Manuel Spínola, Ph.D.*
>> Instituto Internacional en Conservación y Manejo de Vida Silvestre
>> Universidad Nacional
>> Apartado 1350-3000
>> Heredia
>> COSTA RICA
>> mspinola at una.ac.cr
>> mspinola10 at gmail.com
>> Teléfono: (506) 2277-3598
>> Fax: (506) 2237-7036
>> Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
>> Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>
>>
>>     [[alternative HTML version deleted]]
>>
>>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list