Skip to content
Prev 641 / 29559 Next

R-sig-Geo Digest, Vol 26, Issue 12

Hi Roger,

Many thanks for Rgshhs. I am very glad to have this additional source  
of coastlines.

A few comments.

I am impressed with axis label handling when using the "plot" command  
on the spatial polygons imported by Rghhs. I like the suffix given to  
each number, e.g. "300?E". How do you do this? Setting some kind of  
"unit" attribute to the longitudes and latitudes? I don't know how to  
do this, otherwise I'd implement it in the maps I produce with  
PBSmapping.

Second surprise: I reimported the same area but using the option  
"shift=TRUE" to get longitudes West. I'm used to these numbers being  
negative, and indeed they still are here as I must select negative  
longitudes to define xlim. But when issuing the plot command, they  
are labelled properly, i.e. -70 becomes "70?W". In PBSmapping I must  
turn automatic xaxis labelling off and relabel myself. I may switch  
to your classes and methods yet!

However in my first test, I got the lakes to be coloured "azure2" but  
not the ocean, which was white:

NWA.i <- Rgshhs("gshhs_i.b", shift=TRUE, xlim = c(280,340), ylim = c 
(35,75), verbose = TRUE)
plot(NWA.i$SP, xlim=c(-70, -55), ylim=c(45, 51), col="khaki",  
pbg="lightblue", axes=T)

So I read the html doc on sp and discovered pbg was the color of  
"holes", which lakes are but not the ocean, which is just the absence  
of polygons. So I added a bg color to the above plot command, which  
should have taken care of that, but it did not. Do you know why?

Another question: the help on Rgshhs says we can import only land,  
for instance, instead of the 4 hierarchic types in gshhs files, by  
adding "level=1". But if I import everything, can I decide later to  
make a plot with land only? Or to create a layer with only lakes (no  
coastline)? I consulted the help for sp as well as the documentation  
for sp but could not figure out how to do this. When I print the list  
created by Rgshhs or even just the SP part of it, I see that SP is  
made of "slots", one of which contains the level. This information is  
also available in the spatialdata part. But I don't know how to  
select just the polygons with "level==2".

Cheers,

Denis
Le 05-10-22 ? 06:00, r-sig-geo-request at stat.math.ethz.ch a ?crit :