Is Geometry a Ring?
Tests if the given geometry is a ring
gIsRing(spgeom, byid = FALSE)
spgeom |
sp object as defined in package sp |
byid |
Logical determining if the function should be applied across subgeometries (TRUE) or the entire object (FALSE) |
Returns TRUE if the geometry is a LINEARRING.
Returns TRUE if the geometry is a LINESTRING that is both Simple (gIsSimple) and Closed (end points intersect), FALSE otherwise.
Returns FALSE if the geometry is a [MULTI]POINT, MULTILINESTRING, or [MULTI]POLYGON.
Roger Bivand & Colin Rundel
l1 = readWKT("LINESTRING(0 0, 1 1, 1 0, 0 1, 0 0)") l2 = readWKT("LINESTRING(0 0,1 0,1 1,0 1,0 0)") r1 = readWKT("LINEARRING(0 0, 1 1, 1 0, 0 1, 0 0)") r2 = readWKT("LINEARRING(0 0,1 0,1 1,0 1,0 0)") p1 = readWKT("POLYGON((0 0, 1 1, 1 0, 0 1, 0 0))") p2 = readWKT("POLYGON((0 0,1 0,1 1,0 1,0 0))") par(mfrow=c(3,2)) plot(l1);title(paste("LINESTRING\nRing:",gIsRing(l1))) plot(l2);title(paste("LINESTRING\nRing:",gIsRing(l2))) plot(r1);title(paste("LINEARRING\nRing:",gIsRing(r1))) plot(r2);title(paste("LINEARRING\nRing:",gIsRing(r2))) plot(p1);title(paste("POLYGON\nRing:",gIsRing(p1))) plot(p2);title(paste("POLYGON\nRing:",gIsRing(p2)))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.