Repository navigation
fix(analysis): reject geocentric CRS in Kernel Density - #2035
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| )); | ||
| }; | ||
|
|
||
| if crs.is_geocentric() { |
There was a problem hiding this comment.
Medium confidence (~70%), defense in depth. This guard lives only in kernel_density_tool. density::kernel_density (crates/analysis/src/density.rs, around line 305) is re-exported as pub from lib.rs, and its own CRS check still only tests is_geographic(). A geocentric Crs given to that function is gridded as a 2-D plane, which is the failure this PR describes. Adding if crs.is_geocentric() { return Err(...) } next to the geographic check there would keep every caller on one rule, and a test beside the existing geo_crs case would pin it.
Code reviewBugs
Security
Performance
Quality
AGENTS.md
I did not run the tests. I checked the test's key assumption by reading: EPSG:4978 is treated as geocentric elsewhere in the repo ( Prior review threads: none. Nothing was re-raised, so zero earlier concerns were left alone. Change sizeCompared with the base branch: the whole PR against main (merge base 7c377ff to PR head 453e308).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
Summary
Kernel Density now refuses geocentric coordinate systems before transforming points or making its raster. Its calculation uses a two-dimensional projected plane, while systems such as EPSG:4978 describe three-dimensional X/Y/Z coordinates. The existing geographic-CRS check did not exclude them, and equatorial points can pass a two-coordinate round trip even after Z has been dropped.
The check covers both an explicit
crsand the layer's default coordinate system. The error explains the distinction and points to a projected system such as UTM. The guide documents the same rule. An explicit projected target can still override the layer's default CRS.No dependencies, tool parameters or data-model changes. No other project's code was followed or copied. This addresses only the Kernel Density geocentric-CRS finding in #2008; the remaining audit items are outside this PR.
Testing
cargo test -p rustgis-analysis --lib kernel_density_: 8 passed, including the new regression.cargo xtask ci: passed (fmt, Clippy with-D warnings, workspace tests: 6,452 passed / 23 ignored, layers).pre-commit run --all-files: all hooks passed.cargo check --locked --target wasm32-unknown-unknown -p rustgis-analysis: passed.UI evidence
No visible UI change.
Related issue
Part of #2008 (section 2: Reject geocentric CRS in
kernelDensity). Does not close the tracking issue.Summary by CodeRabbit