[R-sig-Geo] RSAGA Vectorizing Grid Classes creates unclosed rings

manuel.schneider at art.admin.ch manuel.schneider at art.admin.ch
Tue May 11 18:35:18 CEST 2010


Dear list

I am trying to use SAGA function Vectorizing grid classes from R but
this creates an unclosed ring in the resulting shapefile. All steps work
in SAGA GUI. Maybe somebody can reproduce the error and help on it.
Otherwise, is there a direct way (in the sp framework) to convert grid
classes into polygons?

> d <- SpatialGridDataFrame(GridTopology(c(0,0), c(1,1), c(5,6)),
data=data.frame(x=sample(rep(c(NA,1,2),10),30)))
> write.asciigrid(d, "test.asc" , na.value=-9999)
> rsaga.esri.to.sgrd(in.grids="test.asc", out.sgrd="classes.sgrd")

SAGA CMD 2.0.3
library path:   C:/ManuProgs/R/R-2.10.1/library/RSAGA/saga_vc/modules
library name:   io_grid
module name :   Import ESRI Arc/Info Grid
author      :   (c) 2007 by O.Conrad
Parameters
Grid: [not set]
File: test.asc
ready
Save grid: classes.sgrd...
ready

> rsaga.geoprocessor(lib="shapes_grid", module=6,
param=list(GRID="classes.sgrd", SHAPES="classes.shp", CLASS_ALL=1))

SAGA CMD 2.0.3
library path:   C:/ManuProgs/R/R-2.10.1/library/RSAGA/saga_vc/modules
library name:   shapes_grid
module name :   Vectorising Grid Classes
author      :   (c) 2008 by O.Conrad
Load grid: classes.sgrd...
ready
Parameters
Grid system: 1; 5x 6y; 0x 0y
Grid: classes.sgrd
Shapes: Shapes
Class Selection: all classes
Class Identifier: 1.000000
Vectorised class as...: each island as separated polygon

vectorising class 1: 1.000000
vectorising class 2: 2.000000
Save shapes: classes.shp...
Save shapes: classes.shp
ready
Save table: classes.dbf...
ready

> classes <- readOGR("classes.shp","classes")
OGR data source with driver: ESRI Shapefile 
Source: "classes.shp", layer: "classes"
with 8 features and 3 fields
Feature type: wkbPolygon with 2 dimensions
Error in is.vector(X) : ring not closed

Thanks in advance
Manuel



More information about the R-sig-Geo mailing list