gEnclosedArea: Return polygons enclosed by a container -based on a percent...

Description Usage Arguments Details Examples

Description

We want to return the reference polygons whose areal overlap with the container falls within some threshold

Usage

1
gEnclosedArea(container, reference, threshold = 0.99)

Arguments

container

The single polygon that will enclose the set of reference polygons

reference

The set of polygons that will be selected down to the containing polygon based on areal overlap

threshold

The percent of areal overlap required for inclusion

Details

This function uses name matching / extraction. It's a kludge and often fails. use gPolyByIntersect instead. Preserved for existing code that uses it.

Note: all inputs should be of class sp::SpatialPolygons|Points.

Areal calculations really only work if the input polygons are rendered in the same planar projection.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
require(sp)
# Use the US National Atlas Lambert Equal Area projection
drivetime.proj = spTransform(drivetime, CRSobj = CRS(EPSG[EPSG$code == 2163 & !is.na(EPSG$code), "prj4"]))
blockgroups.proj = spTransform(block_groups, CRSobj = CRS(EPSG[EPSG$code == 2163 & !is.na(EPSG$code), "prj4"]))
# Return only the blockgroups whose overlap exceeds 20%
gEnclosedArea(drivetime.proj, block_groups.proj, threshold = 0.2)

# Often it will be faster to work with a subset of reference polygons 
reference.bg.proj = gBoundingPoly(drivetime.proj, blockgroups.proj, tolerance = 1.25)
gEnclosedArea(drivetime.proj, reference.bg.proj, threshold = 0.2)

townleym/mSpatial documentation built on May 31, 2019, 6:46 p.m.