Skip to content
Prev 622 / 29559 Next

Accessing gshhs database of world coastlines

Hi Roger,


Le 05-10-17 ? 02:21, Roger Bivand a ?crit :
Yes, I got
 > list.files(pattern="shp")
[1] "gshhs_land.shp"
> getwd()
[1] "/Users/dchabot/Documents/Cartographie/Shapefiles/gshhs"
> getinfo.shape("gshhs_land.shp")
Erreur dans getinfo.shape("gshhs_land.shp") :
     No such file

Wow, these were R commands I did not know! But I just found the  
problem. OS X can "hide" the extension of file names. The names of  
the 3 files appeared correct to me, but I fired Terminal and listed  
the files that way (which I admit I don't do often), and here what I  
got:

LAUchabotd-QC-DFO-MPO-GC-CA:~/Documents/Cartographie/Shapefiles/gshhs  
dchabot$ ls -l
total 336928
-rw-r--r--   1 dchabot  dchabot    8823500 Oct 11 13:07  
gshhs_land.dbf.txt
-rw-r--r--   1 dchabot  dchabot  162143644 Oct 11 13:07 gshhs_land.shp
-rw-r--r--   1 dchabot  dchabot    1534588 Oct 11 13:07  
gshhs_land.shx.txt

2 of the files had a hidden ".txt" which I did not see, but R sure  
did. I fixed these 2 file names and read.shape gave me the same  
number of shapes you got, and it did not take so long. Sorry for this.
So you accessed it using gshhs programs?

You mentioned you could work on a way to adapt gshhs programs so  
they'd be called from R, or bringing the same functionality in R, I'm  
not sure exactly what you meant. But you can save you the trouble for  
one program, "gshhs_dp". I think thinPolys, from PBSmapping,  
implements this already.
I wish I could help, but I really do not have the background to do  
so. I will be happy to test for you though.

Denis