[R-sig-Geo] (no subject)

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 29 11:03:40 CET 2013


On Tue, 29 Jan 2013, Ledile Mankga wrote:

> Dear list members
>
> I am having a problem with reading a shapefile, please have a look at the
> problem below:
>
> koppen <- readOGR("GIS/Koppen_Geiger/koppen.shp", layer="koppen")
> Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv =
> use_iconv) :
>  Cannot open file
>
> then I tried this again,
>
>> koppen <- readOGR(dsn="C:\\Users\\Ledile
> emachines\\Desktop\\Modelling_species _distribution\\SDM
> course\\GIS\\Koppen_Geiger\\koppen.shp", layer="koppen")
> Error in file(paste(dsn, .Platform$file.sep, layer, ".dbf", sep = ""),  :
>  cannot open the connection
> In addition: Warning message:
> In file(paste(dsn, .Platform$file.sep, layer, ".dbf", sep = ""),  :
>  cannot open file 'C:\Users\Ledile emachines\Desktop\Modelling_species
> _distribution\SDM course\GIS\Koppen_Geiger\koppen.shp/koppen.dbf': No such
> file or directory
>

Please always provide the output of sessionInfo(). I am fairly certain 
that you have rgdal < 0.8-4, because this bug was fixed in 0.8-4 - see 
the first entry in:

http://cran.r-project.org/web/packages/rgdal/ChangeLog

In general you should pass the path to the layer as the dsn=, and the 
layer name as layer=. If you use the alternative form, use a complete path 
to the shapefile dsn, which would have worked here if you had updated 
rgdal.

The same problem was mentioned and resolved in:

https://stat.ethz.ch/pipermail/r-sig-geo/2013-January/017226.html

Hope this helps,

Roger

>
>
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
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