Description Usage Arguments Value Note Author(s) See Also Examples

Functions for testing whether geometries share some but not all interior points

1 2 3 4 |

`spgeom1, spgeom2` |
sp objects as defined in package sp. If spgeom2 is NULL then spgeom1 is compared to itself. |

`byid` |
Logical vector determining if the function should be applied across ids (TRUE) or the entire object (FALSE) for spgeom1 and spgeom2 |

`returnDense` |
default TRUE, if false returns a list of the length of spgeom1 of integer vectors listing the |

`checkValidity` |
default FALSE; error meesages from GEOS do not say clearly which object fails if a topology exception is encountered. If this argument is TRUE, |

`gCrosses`

returns TRUE when the geometries share some but not all interior points, and the dimension of the intersection is less than that of at least one of the geometries.

`gOverlaps`

returns TRUE when the geometries share some but not all interior points, and the intersection has the same dimension as the geometries themselves.

Error messages from GEOS, in particular topology exceptions, report 0-based object order, so geom 0 is spgeom1, and geom 1 is spgeom2.

Roger Bivand & Colin Rundel

`gContains`

`gContainsProperly`

`gCovers`

`gCoveredBy`

`gDisjoint`

`gEquals`

`gEqualsExact`

`gIntersects`

`gRelate`

`gTouches`

`gWithin`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ```
l1 = readWKT("LINESTRING(0 3,1 1,2 2,3 0)")
l2 = readWKT("LINESTRING(0 0.5,1 1,2 2,3 2.5)")
l3 = readWKT("LINESTRING(1 3,1.5 1,2.5 2)")
pt1 = readWKT("MULTIPOINT(1 1,3 0)")
pt2 = readWKT("MULTIPOINT(1 1,3 0,1 2)")
p1 = readWKT("POLYGON((0 0,0 2,1 3.5,3 3,4 1,3 0,0 0))")
p2 = readWKT("POLYGON((2 2,3 4,4 1,4 0,2 2))")
par(mfrow=c(2,3))
plot(l1,col='blue');plot(pt1,add=TRUE,pch=16)
title(paste("Crosses:",gCrosses(l1,pt1),
"\nOverlaps:",gOverlaps(l1,pt1)))
plot(l1,col='blue');plot(pt2,add=TRUE,pch=16)
title(paste("Crosses:",gCrosses(l1,pt2),
"\nOverlaps:",gOverlaps(l1,pt2)))
plot(l1,col='blue');plot(l2,add=TRUE)
title(paste("Crosses:",gCrosses(l1,l2),
"\nOverlaps:",gOverlaps(l1,l2)))
plot(l1,col='blue');plot(l3,add=TRUE)
title(paste("Crosses:",gCrosses(l1,l3),
"\nOverlaps:",gOverlaps(l1,l3)))
plot(p1,border='blue',col='blue');plot(l1,add=TRUE)
title(paste("Crosses:",gCrosses(p1,l1),
"\nOverlaps:",gOverlaps(p1,l1)))
plot(p1,border='blue',col='blue');plot(p2,add=TRUE)
title(paste("Crosses:",gCrosses(p1,p2),
"\nOverlaps:",gOverlaps(p1,p2)))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.