checkOverlap: checkOverlap

Description Usage Arguments Details Value Examples

View source: R/checkOverlap.R

Description

Reports on how much two spatial objects overlap.

Usage

1

Arguments

x

A spatial object.

y

A spatial object.

Details

Uses intersect to report on the percentage of the area of x and y that coincides with their common spatial overlap.

Value

A two element numeric vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{

 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 %
 checkOverlap(p[1,], p[2,])

}

fieldRS documentation built on July 8, 2020, 5:37 p.m.