CRAN resubmission. No user-visible changes to package functionality.
calculate_geometric_attributes() is now wrapped in
\donttest{} instead of \dontrun{}, and
operates on two features so that the cluster code path is genuinely
exercised.parallel::detectCores().Accuracy improvements for geodesic workflows. Values of
reock, elongation_rectangle and
maxlength may change for lon/lat input, especially
at high latitudes:
reock) and minimum
bounding rectangle (elongation_rectangle) are now computed
in a local Lambert azimuthal equal-area projection centred on each
feature, instead of in raw lon/lat degrees. GEOS hull constructions are
planar, so minimizing in degree space distorted the “minimum” geometry
wherever a degree of longitude is shorter than a degree of latitude. The
hull is measured back in the input’s CRS.maxlength (and the
distance/bearing outputs of
get_distant_points()) are now found by evaluating
all convex-hull vertex pairs geodesically in a single
vectorised terra::distance() call. The previous
rotating-calipers candidate search operated in planar coordinate space
and could miss the true geodesic maximum. The internal rotating-calipers
helper was removed.Performance and packaging:
calculate_geometric_attributes() gains a vectorised
fast path when only area, perimeter,
decimallongitude and/or decimallatitude are
requested: terra’s multi-feature methods are called once instead of
looping per feature.by_feature branches of calc_extent(),
calc_elongation() and get_distant_points() no
longer compute (and discard) the convex hull of the entire input
set.NAMESPACE now uses targeted importFrom()
declarations instead of blanket import(terra) /
import(methods); the two previously unqualified
subset() / aggregate() calls are now
terra::-qualified.Breaking changes to documented metric contracts:
bearing is now documented as an axial
orientation in [-90, 90] degrees: the maximum-length line is
always oriented from its southernmost to its northernmost endpoint, so
values outside that range were unreachable. 0 = north-south axis, -90/90
= east-west axis. Computed values are unchanged.northerness = cos(bearing) is now documented to range
in [0, 1]; negative values were unreachable.fractaldimension now follows the FRAGSTATS convention
2 * log(0.25 * P) / log(A) (McGarigal & Marks 1995,
doi:10.2737/PNW-GTR-351). Values change relative to the
previous 2 * log(P) / log(A), which could fall outside [1,
2] for small polygons.hole_area_pct now uses the gross area
(including holes) as denominator, matching its documentation.
Values change relative to the previous net-area
denominator.decimallongitude / decimallatitude are now
always in decimal degrees: the centroid is reprojected to EPSG:4326 when
the input CRS is projected. Previously, method = "cosine"
on a projected CRS returned metres under these column names.Other fixes and improvements:
method = "cosine" as
“for planar CRS”. geo, haversine and
cosine are all lon/lat great-circle methods in
terra::distance(); on a projected CRS the argument is
ignored and distances are Cartesian.calc_elongation() computes rectangle side lengths
explicitly from the unique corners in ring order, instead of relying on
undocumented ordering of terra::crds() output, and returns
Inf for degenerate (zero-width) rectangles instead of
failing or dividing by zero.transform argument passed to
terra::expanse(); area is geodesic on lon/lat input and
Cartesian on projected input.num_holes is counted from the hole column
of terra::geom() instead of length() on the
fillHoles() result; num_polygons uses
nrow()."subscript out of bounds" error in
calc_extent(direction = <single>, output = "polygon", by_feature = TRUE).parallel in Imports (used by
calculate_geometric_attributes()).inst/CITATION now uses the installed package version
instead of a hardcoded one.