Skip to content

fix(render): Proportional Symbols scale a point layer's stacked marks, on the map and in the legend (#3400) - #3669

Queued
choupeanut wants to merge 2 commits into
opengeos:mainfrom
choupeanut:fix/3400-proportional-stacked-marks
Queued

choupeanut wants to merge 2 commits into
opengeos:mainfrom
choupeanut:fix/3400-proportional-stacked-marks

Conversation

@choupeanut

@choupeanut choupeanut commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A point layer with stacked marks drawn with Proportional Symbols drew every feature's marks at the stack's own sizes, and its legend listed the same marks for the smallest, middle and largest value (#3400). Only a Size expression or a size mapping scaled the marks.

  • Styler::marks (rustgis-map, symbol_by.rs) now takes a Proportional Symbols renderer's size for the feature as the size the marks scale to, as it does for a Size expression (a Size expression still wins). A non-finite size leaves the marks as they are; a size of 0 draws nothing (the symbol is hidden too, so no 1 px dot is left).
  • Layer::with_size_legend gives the Proportional size rows the layer's marks at each size, so layout legends (rows and nested), the Layers pane legend and counted legends draw them.
  • docs/user-guide/cartography.md says so under Proportional Symbols.

Nothing is dropped or approximated, so no notice or LossCode is added; no command, parameter or saved format changes, and no interface text. The map view, layout map frames and exports all draw through Styler::marks, so they share the fix; the desktop app, browser, command line, Python and phone use the same map and render crates. The Assistant, MCP and plugins read no new option. Left as it was: with a Size expression on a Proportional layer, the legend still shows the proportional sizes (as it did for the plain symbol).

Testing

  • New rustgis-map test symbol_by::tests::proportional_symbols_scale_a_points_marks_with_each_features_size (marks per row, null value, Size expression winning, legend rows, graphics layer, no marks, base size 0, NaN/infinite sizes, size 0). It failed before the change (left: [(10.0, 0.0, 1.0), (2.0, 3.0, 1.0)], right: [(40.0, 0.0, 4.0), (8.0, 12.0, 4.0)]) and passes now.
  • New rustgis-render test tests::proportional_symbols_draw_a_point_layers_marks_at_each_features_size (rendered marks about 5 and 40 pixels across for the smallest and largest value). Passes; not run against the old code.
  • cargo test -p rustgis-map (748 passed), cargo test -p rustgis-render proportional_symbols_draw, cargo clippy -p rustgis-map --all-targets -- -D warnings, cargo clippy -p rustgis-render --all-targets -- -D warnings, cargo fmt --all.
  • cargo xtask ci and the rest of the render and engine tests are left to PR CI.

UI evidence

No screenshots attached yet.

Related issue

Closes #3400

Summary by CodeRabbit

  • New Features
    • Marks on point layers now scale with proportional symbol sizes, and legend rows display marks at each size.
  • Bug Fixes
    • Features with a proportional size of zero no longer display marks.
  • Documentation
    • Clarified how proportional sizing affects point marks and legend entries.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Proportional renderer sizes now scale point-layer marks by feature size. Zero-sized symbols are hidden. Sized legend entries display the layer marks at the corresponding size, and the user guide describes this behavior.

Changes: Proportional Mark Scaling

Layer / File(s) Summary
Scale marks by feature size
crates/map/src/symbol_by.rs, crates/render/src/lib.rs
Point marks use proportional feature sizes after size expressions and size mappings. Zero-sized symbols are hidden. Tests cover mark scaling, missing values, invalid base sizes, and rendered mark widths.
Scale marks in legend rows
crates/map/src/lib.rs, docs/user-guide/cartography.md
Eligible sized legend entries receive layer marks scaled by the entry size relative to the renderer’s base size. The documentation describes mark scaling in proportional symbols and legend rows.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • opengeos/RustGIS#3355: Its nested layout legend uses the proportional-size legend rows that this change updates.
  • opengeos/RustGIS#1185: It introduced expression-sized marks, which this change preserves as the higher-priority sizing behavior.

Suggested reviewers: mavrick-f, pick2510

Merge Risk: Minimal · up to fe3db

Proportional Symbols now scale a point layer's marks with each feature's size, and legend rows show the marks. No blocking risk is identified. A narrow zero-base-size configuration still draws unscaled marks that the legend omits, as it did before this change.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix in rustgis-render's Proportional Symbols path for point layers with stacked marks, on the map and in the legend. The changeset matches it. The title is concise, specific, and s…
Description check Passed The description follows the template sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the problem, the fix in Styler::marks, the legend change, and the docs update. Tes…
Linked Issues check Passed Issue #3400 has one coding objective: stacked marks on a point layer drawn with Proportional Symbols must scale with each feature's proportional size, on the map and in the legend. The change to `Styl…
Out of Scope Changes check Passed All changes connect to #3400. symbol_by.rs changes implement map mark scaling. lib.rs changes implement the legend mark scaling. The render test checks the rendered result of the same behavior. …
Full details: Title check

Explanation

The title names the fix in rustgis-render's Proportional Symbols path for point layers with stacked marks, on the map and in the legend. The changeset matches it. The title is concise, specific, and states the main change. It uses a conventional commit prefix and a PR number, which is acceptable.

Full details: Description check

Explanation

The description follows the template sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the problem, the fix in Styler::marks, the legend change, and the docs update. Testing lists new tests and commands. The UI evidence section says no screenshots are attached yet, but the template says no visible UI change is expected for this case, and the author explicitly reports a visible map and legend change. That is a gap. The Related issue section closes #3400. The author should either attach before and after screenshots of the map and legend or confirm the template's expectation. This is a minor gap, so the check passes.

Full details: Linked Issues check

Explanation

Issue #3400 has one coding objective: stacked marks on a point layer drawn with Proportional Symbols must scale with each feature's proportional size, on the map and in the legend. The change to Styler::marks in crates/map/src/symbol_by.rs takes the Proportional renderer's size for the feature and scales the marks to it, as a Size expression already does. A Size expression still takes precedence. Layer::with_size_legend in crates/map/src/lib.rs gives the Proportional size legend rows the layer's marks at each size, so layout legends, the Layers pane legend and counted legends show the scaled marks. The issue's alternative (state that marks keep one size) is not needed, because the PR implements scaling. Tests: symbol_by::tests::proportional_symbols_scale_a_points_marks_with_each_features_size covers per-row marks, legend rows, graphics layers, absent marks, and NaN, infinite and zero sizes. The PR reports that this test failed before the change. tests::proportional_symbols_draw_a_point_layers_marks_at_each_features_size in crates/render/src/lib.rs checks rendered mark sizes. Evidence came from the PR summary, the description and the test names. I did not read the diff hunks directly. The objective is met by the described behavior.

Full details: Out of Scope Changes check

Explanation

All changes connect to #3400. symbol_by.rs changes implement map mark scaling. lib.rs changes implement the legend mark scaling. The render test checks the rendered result of the same behavior. docs/user-guide/cartography.md documents the new Proportional Symbols behavior. The PR states that no command, parameter, saved format, interface text or LossCode changes. The summary shows no unrelated edits. The change to hide zero-sized symbols for Proportional renderers is part of the size 0 behavior the PR describes. I did not inspect the diff hunks directly, so this verdict rests on the summary and PR description.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

A rabbit sees the circles grow,
As proportional sizes flow.
The legend marks now match the view,
And zero-sized marks hide from view.
I nibble grass beside the key,
While scaled-up dots hop merrily.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 9e86def5-4bcd-456d-92f1-cc23208b9ab3
Commits

Reviewing files that changed from the base of the PR and between 803d816 and fe3dba7.

Files selected for processing: 4

  • crates/map/src/lib.rs
  • crates/map/src/symbol_by.rs
  • crates/render/src/lib.rs
  • docs/user-guide/cartography.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Code review

Two inline comments are buffered on the diff. Both are bug. Nothing else in the diff raised a finding I'd post inline, so the rest is listed here.

Bugs

  • Size 0 is hidden on the CPU path only (crates/map/src/symbol_by.rs:379, medium confidence). The GPU path for Proportional point layers reads the raw layer.symbol(row) and draws it at size.max(1.0) (mesh.rs:308, mesh.rs:634). A row sized 0 still gets a 1 px dot there. Suggested fix: apply hide_zero in Renderer::symbol_in (symbology.rs:1846), which also covers the legend rows.
  • Legend marks disagree with the map under a Size expression (crates/map/src/lib.rs:2051, high confidence that they differ, medium on the fix). The map takes the expression's size for marks, but the legend uses the proportional size. The PR body acknowledges the symbol-size mismatch, but the marks mismatch is new.

Security

  • None found. The change adds no parsing, no I/O and no new input paths.

Performance

  • Low confidence. Styler::proportional_size calls layer.symbol(row), which repeats the field_index name lookup and symbol build that style already did for the same row. This runs on every point, every frame, for Proportional layers only. Passing the already-computed size through would avoid it.

Quality

  • crates/map/src/symbol_by.rs:156 uses Some(10.0 * 22.5 / 10.0). Write Some(22.5) with the comment.
  • crates/map/src/symbol_by.rs:402-404: the doc comment has an overlong line. Reflow it.
  • crates/map/src/symbol_by.rs:378-379: the matches!(…Proportional…) test repeats in apply and marks. A small helper would read better.
  • Low confidence, worth a look: with base size 0, the legend drops a Proportional layer's marks (base.size > 0.0 guard), but marks() keeps them at their authored size, so the map and legend differ. The doc on marks() describes the map case only.

AGENTS.md

  • None found. Checked: no unwrap, expect, panic, unreachable, todo or unsafe in the non-test code. The let-chains are fine under edition 2024. The changes are within rustfmt's 140-column limit. No command, schema, saved-format or asset changes. The PR body states which surfaces it reaches.
  • Twins checked: the Styler::marks callers in render/src/lib.rs (≈6152, 6206, 6305, 6420), the GPU mesh path (mesh.rs 617/634, gpu_layer ≈3842), the layout legend (legend.rs 317, 553, 1290), and the Layers pane and panes.rs callers of with_size_legend. The overlay tools, read routes and wasm32 branches are not touched by this diff.

Earlier review threads

  • None on this PR, so no earlier concerns were left alone.

Change size

Compared with the base branch (merge base 247da33 to PR head fe3dba7).

Measure Value
Files changed 4 (0 added, 4 modified, 0 removed, 0 renamed)
Size before 1387.7 KB
Size after 1395.0 KB
Total size change +7.3 KB
File Before After Change
crates/map/src/symbol_by.rs 35.4 KB 40.1 KB +4.7 KB
crates/render/src/lib.rs 970.0 KB 971.9 KB +1.9 KB
crates/map/src/lib.rs 299.4 KB 299.9 KB +603 B
docs/user-guide/cartography.md 82.9 KB 83.1 KB +162 B

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Commit fe3dba7 from a fork built, but isn't published until a maintainer adds the preview label (once per commit).

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Proportional Symbols on a point layer with stacked marks draws every feature the same size

1 participant