Learn R Programming

fieldRS (version 0.2.3)

geCheck: geCheck

Description

Finds overlaps between polygons in the same shapefile.

Usage

geCheck(x)

Arguments

x

An object of class SpatialPolygons or SpatialPolygonsDataFrame.

Value

A list.

Details

compares all elements of x and returns a a list containing:

  • overlap.df - data.frame where each row shows the indices of which two polygons overlap.

  • overlap.shp - SpatialPointsDataFrame with the actual overlap for each row in overlap.df.

See Also

spCentroid ecDistance

Examples

Run this code
# NOT RUN {
{

require(raster)

# build polygons
df1 <- data.frame(x=c(1, 5, 10, 2, 1), y=c(10, 9, 8, 7, 10))
df2 <- data.frame(x=c(2, 6, 5, 4, 2), y=c(10, 9, 7, 4, 10))
p <- list(Polygons(list(Polygon(df1)), ID=1), 
Polygons(list(Polygon(df2)), ID=2))
p <- SpatialPolygons(p)

# check overlap
co <- geCheck(p)

# show distance matrix
plot(p)
plot(co$overlap.shp, col="red", add=TRUE)

}
# }

Run the code above in your browser using DataLab