fix(processing): preserve dissolve attribute groups - #1978
Conversation
|
Caution Review failedAn error occurred during the review process. Please try again later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🔍 Cloudflare PR preview
|
Code reviewBugs
Security
Performance
Quality
CLAUDE.md
|
- Preserve each dissolve field value's original type across connected and disconnected groups. - Cover numeric group values and no-field disconnected dissolves.
🔍 GitHub Pages PR preview
Note GitHub Pages built this preview successfully, but its serving edge returned HTTP 403 when checked. The links may still be propagating. |
Code reviewBugs: None found. The reworked Security: No issues — purely client-side geometry processing on already-loaded layer data, no new I/O, injection, or untrusted-input handling. Confidence: high. Performance: No concerns; the added grouping pass is a single O(n) map over already-in-memory features, negligible next to the dissolve/union work already being done. Confidence: high. Quality:
CLAUDE.md: No violations — log message style matches the rest of the file (untranslated |
- Carry the first source feature's whole attribute set through Dissolve instead of rebuilding properties from just the dissolve field, so attributes no longer disappear when a group is merged (matching the sidecar's GeoPandas `dissolve`, aggfunc="first"). The field's original value/type still wins because it comes from that same source feature. - Copy the properties object so the result layer never aliases the input layer's. - Extend the dissolve tests to assert a non-dissolve attribute survives, both with and without a dissolve field.
Summary
Addresses #1977
Verification
node --import tsx --test --test-name-pattern="dissolves disconnected polygons" tests/processing.test.tsnpm run buildpre-commit run --files packages/processing/src/vector-tools.ts tests/processing.test.tsOTEX-Cher-WGS.geojson: 290 polygons dissolve into 12 features for the 12 uniqueOTEXvalues