[R-sig-Geo] Rshhs() import problem again

Susumu Tanimura aruminat at gmail.com
Tue Feb 8 09:32:56 CET 2011


Hi there,

The current version of gshhs data has trouble for importing with
Rshhs().

The data was downloaded from
ftp://ftp.soest.hawaii.edu/pwessel/gshhs/gshhs_2.1.0.tbz, and the
following error was given with Rsshs().

> library(maptools)
> gpclibPermit()
> require(gpclib)
> NZx <- c(160,180)
> NZy <- c(-50,-30)
> NZ <- Rgshhs("gshhs/gshhs_c.b", xlim=NZx, ylim=NZy)
Error in Rgshhs("gshhs/gshhs_c.b", xlim = NZx, ylim = NZy) : 
  Data not same version as software

In addition, readShapeSpatial() sometimes does not work for the
shapefile version of gshhs. The shapefile version is available at
ftp://ftp.soest.hawaii.edu/pwessel/gshhs/GSHHS_shp_2.1.0.zip

> M <- readShapeSpatial("GSHHS_shp/c/GSHHS_c_L4")
Error in shp.lst[[i]] : subscript out of bounds
> M <- readShapeSpatial("GSHHS_shp/c/GSHHS_c_L3")
> M <- readShapeSpatial("GSHHS_shp/c/GSHHS_c_L2")
> M <- readShapeSpatial("GSHHS_shp/c/GSHHS_c_L1")
Error in Polygon(coords = crds) : ring not closed
> M <- readShapeSpatial("GSHHS_shp/f/GSHHS_f_L4")
> M <- readShapeSpatial("GSHHS_shp/f/GSHHS_f_L3")
> M <- readShapeSpatial("GSHHS_shp/f/GSHHS_f_L2")
Error in Polygon(coords = crds) : ring not closed
> M <- readShapeSpatial("GSHHS_shp/f/GSHHS_f_L1")
Error in Polygon(coords = crds) : ring not closed

I guess there something wrong in the shapefile format of gshhs.

> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i686-pc-linux-gnu (32-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] gpclib_1.5-1    maptools_0.7-38 lattice_0.19-17 sp_0.9-76      
[5] foreign_0.8-41 

loaded via a namespace (and not attached):
[1] grid_2.12.1
Warning message:
'DESCRIPTION' file has 'Encoding' field and re-encoding is not possible 

Cheers,

--
Susumu Tanimura



More information about the R-sig-Geo mailing list