flagPolygonOverlap: Flag Bad Polygon Overlaps

Description Usage Arguments Details Examples

View source: R/PairsOfBirdSpeciesNicheOverlap_3ormoreSpp.R

Description

This function takes two polygons representing subspecies ranges for Subspecies-A and Subspecies-B and flags for removal intersections between the polygons. Called within polygonTrimmer()

Usage

1
flagPolygonOverlap(subsppPoly1 = polA, subsppPoly2 = polB)

Arguments

subsppPoly1

Polygon for first subspecies to compare

subsppPoly2

Polygon for second subspecies to compare

Details

Checks for intersections in two ways:

1) Any polygon features that are completely subsumed within the other subspecies range are flagged for removal, e.g., if Subspecies-A feature is completely subsumed by Subspecies-B, then the Subspecies-A feature is flagged for removal in its entirety. 2) Any intersections between polygons that do not comprise entire polygon features are flagged for removal such that the intersection is flagged for removal from the larger polygon, but not the smaller polygon. If polygons are the same size, intersection is removed from both. E.g., Subspecies-A has a larger range than Subspecies-B. An intersection between them is removed only from Subspecies-A.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
listFromSubspeciesOcc = subspeciesOccQuery(spp="Cardinalis sinuatus",
        subsppList=c("sinuatus","peninsulae","fulvescens"),pointLimit=100,
        dbToQuery="gbif")
labeledLoc = labelSubspecies(subsppOccList=listFromSubspeciesOcc)
locs = labeledLoc[labeledLoc$subspecies=="sinuatus",]
locs_sin = labeledLoc[labeledLoc$subspecies=="sinuatus",]
locs_ful = labeledLoc[labeledLoc$subspecies=="fulvescens",]
dens_sin = subspeciesDensityMap(localities=locs_sin,quantile=0.95,
        xmin=-125,xmax=-60,ymin=10,ymax=50)
dens_ful = subspeciesDensityMap(localities=locs_ful,quantile=0.95,
        xmin=-125,xmax=-60,ymin=10,ymax=50)
densPol_sin = densityMapToPolygons(densityMap=dens_sin)
densPol_ful = densityMapToPolygons(densityMap=dens_ful)
polygonsToRemove = (flagPolygonOverlap(subsppPoly1=densPol_sin,
        subsppPoly2=densPol_ful))
sin_polygonsToRemove = polygonsToRemove$subsppApoly_toremove
ful_polygonsToRemove = polygonsToRemove$subsppBpoly_toremove
overlapToRemove_sin = polygonsToRemove$subsppA_intToRemove
overlapToRemove_ful = polygonsToRemove$subsppB_intToRemove

kaiyaprovost/subsppLabelR documentation built on Nov. 20, 2018, 9:28 p.m.