Repository navigation
Analysis: A5 equal-area grids, and points counted by cell (#551) - #573
Conversation
Two tools in Analysis › DGGS, on the a5 crate (1.0.0, Apache-2.0, pure Rust): - A5 Grid: the cells at a resolution (0-30) over the map's extent, an input layer's polygons (or its points' and lines' extent) or the world, overlapping (no gaps) or by centre, at most 200,000 cells; - Aggregate Points to A5: a point layer's points (its selection) counted by the cell holding them, with density_per_km2 and a numeric field's sum and mean. Both write a5 (the cell's id in hex), resolution and area_km2; every cell of a resolution has the same area, so a count is a density. Rings across the antimeridian run on past 180 degrees, and those round a pole close along it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI read the PR statically and did not build or run it. The change adds two analysis tools, Bugs / robustness
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head b360309).
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
…s cut to the globe (opengeos#573 review) - An area's cells are estimated from its spherical area and outline before A5 covers it, and well over the cap is refused there; the exact count still applies after. - Map Extent, Input Layer and World go through one expansion (cells_of): counted before any is made, compaction markers skipped, sorted and deduped. The duplicated message is one helper. - A view or layer extent past ±180° or ±90° is cut to the globe; wholly off it is an error. - Aggregate checks the cell cap per point, so one large MultiPoint can't overshoot it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI reviewed Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head b79ed0d)
|
…pengeos#573 review) An extent with no width or height is widened by a hair instead of being taken as off the globe, so a layer of one point, or of points along a parallel or meridian, is covered by the cells holding it. With Cells: Center and no cell centre inside, the error says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI read the full diff and the surrounding code. The PR adds the A5 Grid and Aggregate Points to A5 tools, backed by the Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head 639147f)
|
…utlines checked (opengeos#573 review) - A cell across the antimeridian (or round a pole, when its ring turns past ±180°) is written as two parts of one polygon, each within −180° to 180°, so renderers and exporters draw both sides. - Aggregate leaves out a point whose longitude is past ±360°, with the other unusable positions. - An unknown area is refused instead of read as Map Extent. - A polygon whose outline isn't a ring (under three corners, or not finite) is left out and counted in the message; a hole that isn't one is dropped. - The wall-clock check in the cap test is gone: the estimate's "About" already shows the path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewThe PR adds two A5 DGGS tools, Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head e2a62c1).
|
…pengeos#573 review) - A polygon ring is usable only when its corners are longitudes and latitudes (within ±90°, and ±360° so a ring that runs on past the antimeridian is kept, and is covered across it). - When every polygon part was left out, the error says so instead of "no features to cover". - The messages count polygon parts, as a multipolygon's parts are counted one by one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI read the diff and the changed files. I did not build the crate or run the tests. The PR adds two analysis tools, Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head edb84e6).
|
Code reviewThe PR adds two A5 DGGS tools, Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head 2e3cb39).
|
…tay linear (opengeos#573 review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewThe PR adds the A5 Grid and Aggregate Points to A5 tools. It follows the repo's rules: no Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head e8e93c3)
|
Code reviewI read the full diff and the surrounding code. I didn't build the code or run the tests. The PR adds the A5 Grid and Aggregate Points to A5 tools on the Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head e79e330).
|
…or credited cells (opengeos#573 review) - cells_of takes the coverings as they're made, so a layer of many polygons stops at the one that takes the run over the cap instead of covering them all first. - Aggregate tracks the cells a multipoint's value went to in a set, not a list. - parts says why a side with fewer than four points is left out. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI read the full diff and the surrounding code, and I flagged one possible bug. I had no Bash tool and no network, so I couldn't build the code, run the tests or read the Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head d745d77)
|
…ed (opengeos#573 review) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewI found no blocking issues. The PR adds the A5 Grid and Aggregate Points to A5 tools, the I read the diff and Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base 98921c3 to PR head cbce40a)
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Closes #551, as agreed there. Two tools in a new Analysis › DGGS toolbox, on the
a5crate. It is 1.0.0, Apache-2.0 and pure Rust, and its only dependency,lazy_static, is already in the lockfile, soCargo.lockgains justa5.A5 Grid (
a5Grid): the cells at a resolution (0–30) over:Cells: Overlapping covers the area without gaps (
Containment::Overlapping); Center keeps the cells whose centre is inside.Cap: a run makes at most 200,000 cells, and the error says how many it would make.
cells_of, the same for the three areas).Aggregate Points to A5 (
a5Aggregate): a point layer's points (its selection, when there is one) counted by the cell holding them. Only cells that hold any are written, and the cap is checked per point. It addscountanddensity_per_km2, and a numeric field's_sumand_mean, where a feature's value counts once in each cell (a multipoint's, however many of its points fall there). Points without a usable position are left out, and the message says how many.Fields: both write
a5, the cell's 64-bit id in hex (u64_to_hex, as DuckDB, PostgreSQL,pya5and R read it),resolution, andarea_km2, which is the same for every cell of a resolution.Outlines: a cell across the antimeridian is written as two parts of one polygon, each within −180° to 180°. A cell round a pole is closed along the pole, and split the same way when its ring turns past ±180°.
Inputs checked: an unknown area is refused; a polygon part whose outline isn't a ring (under three corners, or corners past ±90° latitude or ±360° longitude) is left out and counted in the message; Aggregate leaves out a point past ±90° latitude or ±360° longitude.
Docs:
analysis.md, with the tool table and a section, including the cell sizes: resolution 5 is about 33,000 km², 9 about 130 km², 12 about 2 km².On the questions in #551, this PR goes with:
a5dependency inrustgis-analysis;It should build for wasm32 as it's pure Rust, but I couldn't check that here (this machine lacks clang for
zstd-sys), so it's left to CI.Testing
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo xtask layersare clean.rustgis-analysis(dggstests):a_grid_of_equal_cells:get_num_cells(1)cells;u64) is counted and refused;the_estimate_follows_the_count: for three extents and resolutions, the estimate is within a factor of 2 of the cells A5 makes.rings_across_the_antimeridian_and_round_the_poles: cells at 179.99°, −179.99° and both poles have no jump over 180° and close; split for the map, their parts lie within ±180° and have the ring's area, and a cell elsewhere stays whole.points_counted_by_cell:lonlat_to_cell;rustgis-engine,a5_grids_and_points_by_cell: throughgp.run, the world grid's fields, and the sample's cities counted by cell, every city in exactly one.rustgis-analysis: 30 passed;rustgis-engine: 220 (withRUSTGIS_GDAL_BIN);rustgis-ui-egui --lib: 146.rustgis-cli: a resolution 4 grid over South America, 811 pentagons of 132,830 km² each.🤖 Generated with Claude Code