Re: [R] maptools no such file

From: Roger Bivand <Roger.Bivand_at_nhh.no>
Date: Tue, 29 Jan 2008 00:04:12 +0100 (CET)

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?

Roger

> On 28.01.2008 12:35 (UTC+1), Roger Bivand wrote:
>> <pieterprovoost <at> gmail.com> writes:
>>
>> > No, I get the same error message there...
>>
>> Please do not needlesly delete the thread content. Your original question
>> was:
>>
>> "I'm having problems reading a shapefile with read.shape (maptools). I'm
>> absolutely sure my file is there, but I get "no such file". The wd is ok,
>> since read.table for example does find the file.
>>
>
> For testing I copied /usr/local/lib/R/library/rgdal/vectors/cities.shp into
> /usr/home/rhurlin/TEMP/Rscripts/
>
>> > getwd()
>> [1] "D:/somedirectory/R scripts"
>
> [1] "/usr/home/rhurlin/TEMP/Rscripts"
>
>> > read.table("cities.shp")
>> Error in read.table("cities.shp") : empty beginning of file
>> In addition: Warning message:
>> In read.table("cities.shp") :
>> incomplete final line found by readTableHeader on 'cities.shp'"
>>
>> which is self-explanatory, because you were not using read.shape() anyway.
>>
>> You continued:
>>
>> "> read.shape("cities.shp")
>> Error in getinfo.shape(filen) : No such file"
>
> Fehler in getinfo.shape(filen) : No such file
>
>> but did not respond to the suggestion from an R-helper with the output
>> from:
>>
>> readShapePoly("cities.shp")
>
> Fehler in getinfo.shape(filen) : No such file
>
>> Try list.files(pattern="shp$") to see whether your assumption that the
>> files are
>> where you think they are, is justified.
>
> [1] "cities.shp"
>
>> Then get back with the output of
>>
>> getinfo.shape("cities.shp")
>
> Fehler in getinfo.shape("cities.shp") : No such file
>
>> If you want to, you can use file.choose() to choose the file
>> interactively.
>>
>> If you haven't solved this yourself by then (found the files youself), do
>> remember to include the verbatim output of sessionInfo() too.
>
> R version 2.6.1 (2007-11-26)
> i386-unknown-freebsd8.0 # This is 8.0-CURRENT from yesterday
>
> locale:
> de_DE.ISO8859-15/de_DE.ISO8859-15/de_DE.ISO8859-15/C/de_DE.ISO8859-15/de_DE.ISO8859-15
>
> attached base packages:
> [1] stats graphics grDevices utils datasets grid methods
> [8] base
>
> other attached packages:
> [1] maptools_0.7-4 sp_0.9-19 foreign_0.8-23 proto_0.3-8
>
> loaded via a namespace (and not attached):
> [1] ggplot2_0.5.7 lattice_0.17-4 rcompgen_0.1-17
>
>> Roger Bivand
>
>
> It seems, that the C call of 'Rshapeinfo' makes trouble on my system.
> Rshapeinfo.c tries to open the shapefile with the following code:
>
> hSHP = SHPOpen( shpnm[0], "rb" );
>
> If I did not misunderstood, this returns NULL on my system.
>
> I have almost no C programming skills, so I am not able to understand the
> code enough.
>
> Could something be wrong in using 'gettext'? (GNU gettext-runtime 0.16.1)
>
> Hope this helps a bit,
> Rainer
>
>

-- 
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

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Mon 28 Jan 2008 - 23:08:25 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 Jan 2008 - 11:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive