Skip to content
Prev 22546 / 29559 Next

Holes in polygons disappear after performing checkPolygonsHoles from maptools

Am 02.04.2015 um 22:24 schrieb Roger Bivand:
|Thank you for your answers guys. But I am still not fully convinced 
that it is an issue of the plot function,
because the object shape_with_hole edited with checkPolygonsHoles 
before, continues to behave in a strange way:

# we check which polygons are flagged as holes.
# The flags are still set properly,
# although the plot() function didn't recognize them:
sapply(shape_with_hole at polygons[[1]]@Polygons, slot, "hole")

[1] FALSE  TRUE  TRUE  TRUE

# load library rgdal for reprojection
library(rgdal)

# reproject with spTransform, just for testing
shape_with_hole <- spTransform(shape_with_hole, CRS("+proj=longlat 
+ellps=WGS84 +datum=WGS84"))

# after reprojection all flags are set to FALSE
sapply(shape_with_hole at polygons[[1]]@Polygons, slot, "hole")

[1] FALSE FALSE FALSE FALSE


So it is still something wrong with shape_with_hole, or?

Best

Grigory|