[R-sig-Geo] Accessing gshhs database of world coastlines
Denis Chabot
chabotd at globetrotter.net
Mon Oct 17 01:21:42 CEST 2005
Hi Roger,
Le 05-10-16 à 14:09, Roger Bivand a écrit :
> On Sun, 16 Oct 2005, Denis Chabot wrote:
>
>> ...
>> I thought I did not need to because a shapefile version of the
>> database exists, and I have managed (with help from Roger in
>> particular) to import such files in R before. But this one is huge
>> (154 MB for the shp file alone). The function read.shape refuses to
>> open it, telling me right way
>>
>> Erreur dans read.shape("gshhs_land.shp") : unable to open file
>>
>
> This means read.shape() cannot see the file.
Maybe my copy is correupted? I tried again giving the full pathname
to the file to insure I had not screwed up with defining my working
directory, and got yet the same (or close to):
> test <- read.shape("Macintosh
HD:Users:dchabot:Documents:Cartographie:Shapefiles:gshhs:gshhs_land.shp"
)
Erreur dans read.shape("Macintosh
HD:Users:dchabot:Documents:Cartographie:Shapefiles:gshhs:gshhs_land.shp"
) :
unable to open file
(I had used a utility to give me the full pathname of the shp file).
Alternative explanation: I just upgraded to R2.2, and wiped out my
2.1 install. Because R2.2 is not officially on line at CRAN yet, I
could not download mac binaries for maptools and sp and compiled them
myself. I did get a warning about some name being used twice, and
although the package seems to work (it certainly imports a smaller
shapefile) maybe it is not 100% functional.
> I managed to read
> gshhs_land.shp into R with current maptools:
>
>
>> try1 <- read.shape("gshhs_land.shp")
>>
> Shapefile type: PolyLine, (3), # of Shapes: 191811
>
>> object.size(try1)
>>
> [1] 395387692
>
> but it is a shapefile of lines, not polygons - the base GSHHS is now
> polygonal.
I don't understand this part. the "gshhs_land" is not "base GSHHS"? I
thought I downloaded the most recent version, at the highest
resolution. Where did you find the version with polygons?
> I have 1GB under linux, so I think memory management is
> effectively the same as yours. I've put a PDF (33MB) of your area on:
>
> http://spatial.nhh.no/misc/nw_atlantic.pdf
>
> please save link as, and open locally, otherwise you'll be sitting
> looking
> at a blank screen for a long time. I did this so that you can use the
> Acroread zoom to find out if your islands are there.
Yes the islands are there! This coastline is an improvement on what I
have!
>
> read.shape() was not too slow, it seemed to go quite well.
>
> Is there any use in writing an R function on top of the gshhs
> program for
> extracting polygons from the gshhs databases directly into sp class
> objects - it doesn't look too difficult, and would give direct access
> without having to use the shapefile?
>
I would love to have it. At a minimum, I'd need clear(er)
instructions as to how to compile and use the programs provided on
GSHHS's site. But until now I valued being able to work with my
dataset in R as I am used to, and produce maps for the right subset
of data I'm interested in. So I don't plan to use GMT any time soon
and would much prefer R functions to access the very nice gshhs
databases and take what I need out of them.
As an aside, to you know of a way to do map borders in R that look
like those in GMT and many paper maps (thick borders, alternating
from white to black from one degree of lat or long to the next)? This
is a cosmetic issue only but it would be a nice touch to be able to
do this in R.
Anyway, I'll wait a few days for the full R2.2 Mac to be at CRAN and
get fresh binaries of maptools and sp to see if I can open that
shapefile, since you were able to. It irritates me to have failed.
With many thanks,
Denis
More information about the R-sig-Geo
mailing list