[R-sig-Geo] Rshhs() import problem again
Susumu Tanimura
aruminat at gmail.com
Tue Feb 8 10:15:28 CET 2011
Dear Roger,
Thank you for your usual support. Yes, you are definitely right. I
should have checked r-forge before reporting the problem.
On Tue, 8 Feb 2011 09:44:51 +0100 (CET)
Roger Bivand <Roger.Bivand at nhh.no> wrote:
> 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.
Yes, you are right. I should try them with rgdal package. The result was
that the errors occurred with problematic shapefiles.
> ogrInfo("GSHHS_shp/c/","GSHHS_c_L4")
Error in ogrInfo("GSHHS_shp/c/", "GSHHS_c_L4") : Multiple # dimensions:
> M <- readOGR("GSHHS_shp/c/","GSHHS_c_L4")
Error in ogrInfo(dsn = dsn, layer = layer, input_field_name_encoding = input_field_name_encoding) :
Multiple # dimensions:
> ogrInfo("GSHHS_shp/c/","GSHHS_c_L1")
Source: "GSHHS_shp/c/", layer: "GSHHS_c_L1"
Driver: ESRI Shapefile number of rows 790
Feature type: wkbPolygon with 2 dimensions
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
Number of fields: 6
name type length typeName
1 id 4 80 String
2 level 2 11 Real
3 source 4 80 String
4 parent_id 2 11 Real
5 sibling_id 2 11 Real
6 area 2 24 Real
> M <- readOGR("GSHHS_shp/c/","GSHHS_c_L1")
OGR data source with driver: ESRI Shapefile
Source: "GSHHS_shp/c/", layer: "GSHHS_c_L1"
with 790 features and 6 fields
Feature type: wkbPolygon with 2 dimensions
Error in is.vector(X) : ring not closed
> ogrInfo("GSHHS_shp/f/","GSHHS_f_L2")
Source: "GSHHS_shp/f/", layer: "GSHHS_f_L2"
Driver: ESRI Shapefile number of rows 6647
Feature type: wkbPolygon with 2 dimensions
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
Number of fields: 6
name type length typeName
1 id 4 80 String
2 level 2 11 Real
3 source 4 80 String
4 parent_id 2 11 Real
5 sibling_id 2 11 Real
6 area 2 24 Real
> M <- readOGR("GSHHS_shp/f/","GSHHS_f_L2")
OGR data source with driver: ESRI Shapefile
Source: "GSHHS_shp/f/", layer: "GSHHS_f_L2"
with 6647 features and 6 fields
Feature type: wkbPolygon with 2 dimensions
Error in is.vector(X) : ring not closed
> ogrInfo("GSHHS_shp/f/","GSHHS_f_L1")
Source: "GSHHS_shp/f/", layer: "GSHHS_f_L1"
Driver: ESRI Shapefile number of rows 180497
Feature type: wkbPolygon with 2 dimensions
+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
Number of fields: 6
name type length typeName
1 id 4 80 String
2 level 2 11 Real
3 source 4 80 String
4 parent_id 2 11 Real
5 sibling_id 2 11 Real
6 area 2 24 Real
> M <- readOGR("GSHHS_shp/f/","GSHHS_f_L1")
OGR data source with driver: ESRI Shapefile
Source: "GSHHS_shp/f/", layer: "GSHHS_f_L1"
with 180497 features and 6 fields
Feature type: wkbPolygon with 2 dimensions
Error in is.vector(X) : ring not closed
Since this trial is merely from my curiosity, I give up the further
examination. But thank you very much for the comments.
Best wishes,
--
Susumu
More information about the R-sig-Geo
mailing list