geostyler / geostyler-mapbox-parser

GeoStyler-Style-Parser implementation for Mapbox
BSD 2-Clause "Simplified" License
14 stars 9 forks source link

Split fill and outline properties in separate symbolyzers #214

Closed slafayIGN closed 1 year ago

slafayIGN commented 1 year ago

The mapbox style specification has only a fill-outline-color concerning the outline on a layer of type=fill (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-fill-fill-outline-color) whereas other style formats (SLD, QML...) have many other properties. Every other outline properties are non-existent for a Fill layer. This is the issue behind this outline_width concern https://github.com/geostyler/geostyler/issues/1811.

The trick would be to split a Symboliser in two separated layers : a Fill layer (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#fill) and a Line layer (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#line).

So when converting from e.g. SLD or QML to Mapbox, one symbolizer would lead to two.

In addition, we could use the metadata field (https://docs.mapbox.com/mapbox-gl-js/style-spec/root/#metadata) to make Mapbox style specs generated from Geostyler convertible back to other style formats with merging of outline and fill (thanks @ahocevar for the suggestion)

slafayIGN commented 1 year ago

First PR #216 superseded by PR #217

KaiVolland commented 1 year ago

@slafayIGN do you think this issue is resolved?

slafayIGN commented 1 year ago

Yes 👍 @ocruze tested it with geostyler-rest both ways. Issue solved 🎉

JagnDC commented 1 year ago

Hi, could you please send me some sample code?

The trick would be to split a Symboliser in two separated layers : a Fill layer (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#fill) and a Line layer (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#line).

This is my first time using this library, and I am not very familiar with ts. If possible, can you tell me how to correct it in geostyler-cli

JagnDC commented 1 year ago

Hi, could you please send me some sample code?

The trick would be to split a Symboliser in two separated layers : a Fill layer (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#fill) and a Line layer (https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#line).

This is my first time using this library, and I am not very familiar with ts. If possible, can you tell me how to correct it in geostyler-cli

I wanna using fillOpacity in sld to Mapbox. How can I do it?

slafayIGN commented 1 year ago

Hi @JagnDC ,

Thank you for your interest in Geostyler. You can use the geostyler-demo to experiment with a fill symbolizer with different opacity for fill and outline. Then you can change the editor panel on the right to switch from the default SLD format to Mapbox to figure out how it is split and which properties are translated.

Also the geostyler-cli should be up to date with the latest version of the mapbox-parser, so this resolved issue shouldn't need any more work and won't be reopened.

If further discussion is needed, I think it would probably fit best in discussions or on the discord of the project.