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

Roger Bivand Roger.Bivand at nhh.no
Tue Feb 8 09:44:51 CET 2011


On Tue, 8 Feb 2011, Susumu Tanimura wrote:

> 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

Please try the pre-release version 0.8-2 from R-forge:

https://r-forge.r-project.org/R/?group_id=943

or:

install.packages("maptools", repos="http://R-Forge.R-project.org")

which should work with the latest GSHHS files.

>
> 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.
>

Do the same errors occur with readOGR() in rgdal? I have not downloaded 
the GSHHS shapefiles, but will if you cannot check.

Best wishes,

Roger

>> 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
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list