Repository navigation
perf(analysis): Largest overlap measures a line's steps without a solve each - #2754
Conversation
…ve each join::length_m summed a geodesic solve per segment. On a dense line target that cost more than the clip it measured: a 300,000-vertex line over six zones spent about 200 ms in it (dev). It now measures each step with wgs84_step_m, within a millionth of the solve, and the solve itself for long steps and steps by a pole.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI read the full diff, the base-branch AGENTS.md, and the surrounding code in Bugs: None found (confidence high, about 90%). Non-finite input still gives NaN, and out-of-range latitudes still clamp, through the same fallback path as before. The projected path is untouched. Security: None found. Performance: None new. The change replaces a geodesic solve per segment with a few multiplications for short steps, which matches the PR's measurements. Only one caller ( Quality:
AGENTS.md: No violations found.
Prior review threads: none on this PR, so no concerns were left alone. Change sizeCompared: the whole PR against main (merge base 2b9fc33 to PR head 19aacd2).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the |
Summary
Spatial Join's Largest overlap ranks a line target's overlaps by their length on the WGS 84 ellipsoid (#2730).
join::length_msummed a GeographicLib inverse solve for every segment. #2730 said that cost was small next to the overlay, but that was measured for areas only. For a line, the clip is a single pass over the vertices, and the solves cost more than the clip they measure.length_mnow measures each step withrustgis_geom::wgs84_step_m, as a route's steps are measured since #2730. That uses the ellipsoid's radii of curvature at the step's mean latitude, within a millionth of the solve for steps up to 0.05° below 89°, and is the solve itself for longer steps and steps by a pole.On a line of 300,000 vertices (steps of 1e-5° in longitude, about a metre) clipped by six zones, three runs each on this box:
join::length_mover the line, devjoin::length_mover the line, releaseThe release runs of the whole join shared the box with another build, so their spread is wider than the 100 ms the length step saves there. The zone chosen and the length agree: 6,354,720.6485 m from the solve, 6,354,720.6485 m from the steps, a difference of 1e-5 m. The probe was a throwaway test, not part of this pull request.
Nothing else changes: areas keep the polygon pass, and projected runs keep their plane's length.
Surfaces: Spatial Join runs the same from the desktop, the browser, the command line, Python, the Assistant and MCP. No parameters, output fields or saved data change.
Testing
join::tests::largest_overlap_ranks_overlaps_on_the_ellipsoidgains a dense road, 0.01° steps along a meridian. Each overlap's length agrees withwgs84_length_mto within a millionth, the tolerance the routing test uses, and the same zone wins as for the two-vertex road. With each step's length made 2e-6 too long, it fails with110574.60970375789 m, 110574.38855779874 m on the ellipsoid.cargo test -p rustgis-analysis --lib join::(41 passed),cargo clippy -p rustgis-analysis --all-targets -- -D warnings, and the full CI on the fork.Related issue
Follows up a review point on #2730 (#2730 (comment)).
Summary by CodeRabbit