View source: R/flagPolygonOverlap.R
flagPolygonOverlap | R Documentation |
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()
flagPolygonOverlap(
subsppPoly1 = polA,
subsppPoly2 = polB,
crs = "+proj=longlat +ellps=WGS84"
)
subsppPoly1 |
Polygon for first subspecies to compare |
subsppPoly2 |
Polygon for second subspecies to compare |
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.
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,quant=0.95,
xmin=-125,xmax=-60,ymin=10,ymax=50)
dens_ful = subspeciesDensityMap(localities=locs_ful,quant=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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.