[R-sig-Geo] Extracting GSHHS global coastlines

r-sig-geo.20.trevva at spamgourmet.com r-sig-geo.20.trevva at spamgourmet.com
Thu Aug 9 14:02:45 CEST 2012


Dear R-sig-geo,

I seem to be having problems with the GSHHS interface that I was
wondering if you could help with? I would like to extract the global,
low-resolution coastline from the database. Here's my script:

library(maptools)
xlims <- c(0,360)
ylims <- c(-90,90)
gshhs.file <- system.file("share/gshhs_c.b", package="maptools")
world <- Rgshhs(gshhs.file, xlim=xlims, ylim=ylims,level=1,checkPolygons=TRUE)

Which results in the following output:

Data are polygon data
Loading required package: rgeos
Loading required package: stringr
Loading required package: plyr
rgeos: (SVN revision 343M)
 GEOS runtime version: 3.3.2-CAPI-1.7.2
 Polygon checking: TRUE

Polygon 5 is Antarctica
  area 13956598
  dropping south edge to -90
Rgshhs: clipping 4 of 785 polygons ...
Error in slot(gI, "polygons") :
  no slot of name "polygons" for this object of class "SpatialCollections"
>

Using getRgshhsMap() instead results in a different error:

> world <- getRgshhsMap(gshhs.file, xlim=xlims, ylim=ylims,level=1)
Data are polygon data
Polygon 5 is Antarctica
  area 13956598
  dropping south edge to -90
Rgshhs: clipping 4 of 785 polygons ...
Error in slot(gI, "polygons") :
  no slot of name "polygons" for this object of class "SpatialCollections"
Data are polygon data
Polygon  is Antarctica
  area 50577991
  dropping south edge to -90
Error in polys[[which(chosen_0 == (Antarctica - 1))]] :
  attempt to select less than one element
>

Am I doing something wrong? Or is this a bug?

Am running maptools 0.8-14 with sp 0.9-99 and rgeos 0.2-6 on R 2.14.1

Best wishes,

Mark



More information about the R-sig-Geo mailing list