# pred-unary-gIsRing: Is Geometry a Ring? In rgeos: Interface to Geometry Engine - Open Source ('GEOS')

## Description

Tests if the given geometry is a ring

## Usage

 `1` ```gIsRing(spgeom, byid = FALSE) ```

## Arguments

 `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)

## Value

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.

## Author(s)

Roger Bivand & Colin Rundel

`gIsEmpty` `gIsSimple` `gIsValid`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```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))) ```