Skip to content

feat(cartodiagram): add polygon merge and configurable area mask rendering#44

Open
pierrejego wants to merge 4 commits intoterrestris:5.0.0-customfrom
geo2france:issue-38692
Open

feat(cartodiagram): add polygon merge and configurable area mask rendering#44
pierrejego wants to merge 4 commits intoterrestris:5.0.0-customfrom
geo2france:issue-38692

Conversation

@pierrejego
Copy link

SUMMARY

This PR improves polygon rendering in the plugin-chart-cartodiagram for filtered thematic maps.

It introduces two optional visualization features for polygon geometries:

  • dynamic polygon merging to display only the outer perimeter of adjacent filtered entities;
  • a configurable area mask to fade the area outside the currently relevant polygon perimeter.

The goal is to improve readability when working with administrative boundaries at different levels, especially when cross-filtering or focusing on aggregated areas.

Main changes:

  • added Merge Polygon Entities as an optional chart setting;
  • added client-side polygon perimeter merging for adjacent polygon features;
  • added Show Area Mask as an optional chart setting;
  • added configurable mask opacity and mask color;
  • added configurable merged polygon stroke width and stroke color;
  • kept the original data layer for interactions while rendering merged polygons in a dedicated presentation layer;
  • added geometry utilities to reconstruct merged perimeters and build the mask geometry;
  • documented the edge-comparison precision used during merge operations.

Implementation note:
the merge logic is display-oriented and based on shared edge detection after coordinate normalization. It is not a full topological union or buffer-based dissolve.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Screenshots/GIF can be added here if needed.

TESTING INSTRUCTIONS

  1. Open a dashboard or chart using the plugin-chart-cartodiagram with polygon geometries.
  2. Enable Merge Polygon Entities in the chart customization panel.
  3. Verify that adjacent filtered polygon entities are rendered as an outer perimeter without internal boundaries.
  4. Change Merged Polygon Stroke Width and Merged Polygon Stroke Color.
  5. Verify that the merged perimeter style updates correctly.
  6. Enable Show Area Mask.
  7. Verify that a mask is rendered outside the currently relevant polygon area.
  8. Change Area Mask Opacity and Area Mask Color.
  9. Verify that the mask style updates correctly.
  10. Toggle the merge and mask options on and off multiple times.
  11. Verify that the map does not crash and that cross-filter interactions still work as expected.

ADDITIONAL INFORMATION

- Reuse parsed OpenLayers features to avoid repeated geometry parsing
- Fit map from existing features instead of re-parsing records
- Simplify feature construction in dataRecordsToOlFeatures
clarify dataFeatures usage and clean up OlChartMap
@pierrejego
Copy link
Author

This PR had been made on top of #41

@pierrejego pierrejego marked this pull request as ready for review March 23, 2026 17:15
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.

1 participant