R/reportingPolygons.R
joinReportingPolygons.RdJoin two reporting polygons, preserving their features;
concatenate the Name.* fields into a single Name field.
E.g., if x and y each contain 2 features, the resulting object will contain 4
features (corresponding to x1.y1, x1.y2, x2.y1, and x2.y2).
joinReportingPolygons(x, y)an sf or SpatVector (anything terra::vect() accepts).
a polygons object of the same class as x (sf unless x was a
SpatVector).
The concatenated Name is what makes the crossings work downstream: both
nrvtools::calculateLandWebMetrics() and nrvtools::subregion_forested_area()
group by name, not by feature, so a sub-region split into several disjoint
parts inside a tenure is tallied as one unit for free.
Repair goes through spatialutils::repair_geoms() (terra::makeValid() on just
the invalid subset), not sf::st_make_valid(): the latter collapses the
reversed ring-winding-order polygons present in the v10 FMA layer (e.g. Prince
Albert, -31,600 km^2 -> a 4 km^2 sliver) that terra correctly re-orients.
The intersection itself uses terra::intersect() rather than v2's
sf::st_intersection(). On the real v10 layers st_intersection() throws GEOS
TopologyException: side location conflict on some already-repaired tenure x
Caribou pairs (e.g. Dawson Creek TSA), which silently cost those units their
reporting polygons; terra::intersect() handles the same geometries. Using one
engine (the same one the repair already runs through) also keeps the result
deterministic, rather than depending on which pairs happen to trip GEOS.