Skip to content

fix: apply polygon styling to GeoJSON MultiPolygon features#1727

Open
jamesarich wants to merge 1 commit into
googlemaps:mainfrom
jamesarich:fix/geojson-multipolygon-style
Open

fix: apply polygon styling to GeoJSON MultiPolygon features#1727
jamesarich wants to merge 1 commit into
googlemaps:mainfrom
jamesarich:fix/geojson-multipolygon-style

Conversation

@jamesarich

@jamesarich jamesarich commented Jul 16, 2026

Copy link
Copy Markdown

Fixes #1724 🦕

GeoJsonMapper.toFeature matched MultiGeometry in the LineString branch, so a MultiPolygon feature carrying simplestyle properties was given a LineStyle. MapViewRenderer casts the feature style with as? PolygonStyle when rendering each member polygon, gets null, and draws the polygons with SDK defaults — the feature's fill/fill-opacity/stroke were silently dropped. Any per-class MultiPolygon export (coverage contours, choropleths) loses its coloring.

Change: a multi-geometry whose members are all (recursively) polygons — i.e. a GeoJSON MultiPolygon — now takes the polygon styling branch. MultiLineStrings and mixed geometry collections keep the previous line styling, so no existing behavior changes for them.

Tests: two new tests in GeoJsonStylingTest — a styled MultiPolygon yields a PolygonStyle with the expected fill/stroke, and a styled MultiLineString still yields a LineStyle. Full :data:testDebugUnitTest suite passes.


Developed with AI assistance (Claude Code); the analysis, fix, and tests were reviewed and run locally by the author before submission.

@google-cla

google-cla Bot commented Jul 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

GeoJsonMapper matched MultiGeometry in the LineString branch, so a
MultiPolygon feature carrying simplestyle properties was given a
LineStyle. MapViewRenderer then casts the feature style with
'as? PolygonStyle' when rendering each member polygon, gets null, and
draws the polygons with SDK defaults — the feature's fill and stroke
colors were silently dropped.

Style a multi-geometry whose members are all (recursively) polygons —
i.e. a GeoJSON MultiPolygon — with PolygonStyle; mixed collections and
MultiLineStrings keep the previous line styling.
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.

GeoJsonMapper applies LineStyle to MultiPolygon features, dropping simplestyle fill

2 participants