[R] maptools no such file

Roger Bivand Roger.Bivand at nhh.no
Tue Jan 29 18:19:14 CET 2008


Rainer Hurling <rhurlin <at> gwdg.de> writes:

>
> 
> Am 29.01.2008 00:04 (UTC+1) schrieb Roger Bivand:
> > On Mon, 28 Jan 2008, Rainer Hurling wrote:
> > 
> >> Roger,
> >>
> >> I tried your suggestions and ran into same problems as Pieter did before.
> >>
> > 
> > Rainer:
> > 
> > I don't think that we know what platform Pieter was using, apart from the 
> > working directory that looked like Windows, and where the problem could 
> > not be reproduced. I note that yours is FreeBSD 8, and I agree, the .C() 
> > interface to the small helper function should most likely be replaced by a 
> > .Call() to make handling the file name more robust. Can I send a modified 
> > version off-list tomorrow, since I have no access to your platform 
> > otherwise? Is readOGR() in rgdal working, by the way?
> > 
> 

The resolution was to check that the working directory (or equivalently the
directory in which the *.shp file was located) had all three files needed to
make a shapefile. A shapefile is composed of *three* files, a *.shp with the
geometries, a *.shx with an index to the geometries, and a *.dbf for the data.
All these three must be in the same directory, and are only linked together by
having the same filename without the extensions. 

The design is of course very dated, and for compatibility reasons has only been
changed by adding yet more files with the same name but different extensions.
When at least these basic three files were present, the problems went away. The
next release of maptools will have an improved error message.

Roger

> Roger,
> 
> cities <- readOGR("./R\ scripts", "cities")
> 
> works well for me.
> 
> Rainer
>



More information about the R-help mailing list