[R-sig-Geo] Slivers in thinned spatial polygon

Kurt Ranalter k.ranalter at gmail.com
Tue Mar 26 10:20:05 CET 2013


Dear list,

while trying to simplify a SpatialPolygons object by means of the
thinnedSpatialPoly function of the maptools package, I've encountered
the following problem.

As far as I understand things, setting the topologyPreserve option to
TRUE should allow one to avoid slivers. However, when I use the
function in this way, this does not seem to happen: see for instance
the graph produced by the following example session.

> require(maptools)
Loading required package: maptools
Loading required package: foreign
Loading required package: sp
Loading required package: grid
Loading required package: lattice
Checking rgeos availability: TRUE
> require(maps)
Loading required package: maps
>
> map <- map("italy", plot = FALSE)
> sp <- map2SpatialPolygons(map, IDs = map$names)
>
> t <- sp at polygons[[114]]
> a <- sp at polygons[[16]]
>
> ta <- SpatialPolygons(list(t, a))
>
> ta.thin <- thinnedSpatialPoly(ta, tolerance = 0.02,
+                               topologyPreserve = TRUE)
Loading required package: rgeos
rgeos: (SVN revision 360)
 GEOS runtime version: 3.3.5-CAPI-1.7.5
 Polygon checking: TRUE
>
> plot(ta, border = "grey")
> plot(ta.thin, add = TRUE)

I'm not sure whether I'm just missing something obvious. Any help
would be much appreciated.

Best wishes,

Kurt



More information about the R-sig-Geo mailing list