Re: [R] maptools no such file

2008-01-29 Thread Rainer Hurling
--
X-USF-Spam-Status: hits=-2.5 tests=BAYES_00,FORGED_RCVD_HELO
X-USF-Spam-Flag: NO

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?
 

Roger,

cities - readOGR(./R\ scripts, cities)

works well for me.

Rainer



 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




__
R-help@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.


Re: [R] maptools no such file

2008-01-28 Thread Roger Bivand
 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.

 getwd()
[1] D:/somedirectory/R scripts
 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

but did not respond to the suggestion from an R-helper with the output from:

readShapePoly(cities.shp)

Try list.files(pattern=shp$) to see whether your assumption that the files are
where you think they are, is justified.

Then get back with the output of

getinfo.shape(cities.shp)

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.

Roger Bivand


 
 --
 This message was sent on behalf of pieterprovoost at gmail.com at
openSubscriber.com
 http://www.opensubscriber.com/message/r-help at r-project.org/8476734.html
 
 __
 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.
 


__
R-help@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.


Re: [R] maptools no such file

2008-01-28 Thread Roger Bivand
Roger Bivand Roger.Bivand at nhh.no writes:

 
  pieterprovoost at gmail.com writes:
 
  
  No, I get the same error message there...
 
 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.
 
  getwd()
 [1] D:/somedirectory/R scripts
  read.table(cities.shp)
 
 which is self-explanatory, because you were not using read.shape() anyway.

OK - this was your test that the file existed. read.dbf(cities.dbf) might 
have been more helpful.


To check that there is no spaces in path names problem here, I tried:

 library(maptools)
 getwd()
[1] /home/rsb/tmp/bigshape/R scripts
 list.files(pattern=shp$)
[1] co37_d90.shp
 getinfo.shape(co37_d90.shp)
Shapefile type: Polygon, (5), # of Shapes: 104
 shp - read.shape(co37_d90.shp)
Shapefile type: Polygon, (5), # of Shapes: 104

admittedly on Linux and with an up-to-date package. I have also checked on
Windows XP, also with current maptools and R 2.6.1, with the same result. Seeing
your sessionInfo() would show both your platform and package version.

Roger

 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.
 
 Roger Bivand
 
  
  --
  This message was sent on behalf of pieterprovoost at gmail.com at
 openSubscriber.com
  http://www.opensubscriber.com/message/r-help at r-project.org/8476734.html
  
 
 __
 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.
 


__
R-help@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.


Re: [R] maptools no such file

2008-01-28 Thread Rainer Hurling
Roger,

I tried your suggestions and ran into same problems as Pieter did before.

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

__
R-help@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.


Re: [R] maptools no such file

2008-01-28 Thread 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?

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: [EMAIL PROTECTED]

__
R-help@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.


Re: [R] maptools no such file

2008-01-27 Thread Takatsugu Kobayashi
can you open your shapefile using reaPolyShape in sp?

[EMAIL PROTECTED] wrote:
 Hello,

 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.

   
 getwd()
 
 [1] D:/somedirectory/R scripts
   
 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'
   
 read.shape(cities.shp)
 
 Error in getinfo.shape(filen) : No such file

 Any thoughts?

 Thanks
 Pieter

 --
 This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com
 http://www.opensubscriber.com/messages/r-help@r-project.org/topic.html

 __
 R-help@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.


__
R-help@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.


Re: [R] maptools no such file

2008-01-27 Thread pieterprovoost
No, I get the same error message there...

--
This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com
http://www.opensubscriber.com/message/r-help@r-project.org/8476734.html

__
R-help@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.