geostyler / geostyler-sld-parser

GeoStyler-Style-Parser implementation for SLD
BSD 2-Clause "Simplified" License
51 stars 30 forks source link

Dynamic point icon symbology based on feature attributes #387

Open jansule opened 3 years ago

jansule commented 3 years ago

Feature Request

Is your feature request related to a problem? Please describe.

Only one image can be applied for features in a layer. To have different icons, we need to either create multiple rules or have multiple layers for each image.

Describe the solution you'd like

Icon url should be decided based on feature attribute values and {{ templates }} in a similar way how the label for TextSymbolizer is created.

Describe alternatives you've considered

Walkaround is to create multiple rules and filters with one IconSymbolizer per each rule-filter pair.

Additional context

This is a copy of https://github.com/geostyler/geostyler-openlayers-parser/issues/363 by @raitisbe. See also https://github.com/geostyler/geostyler-openlayers-parser/pull/364

jnewmoyer commented 2 years ago

Wouldn't this be up to the renderer to do?

jansule commented 2 years ago

Wouldn't this be up to the renderer to do?

I'm not sure, if I understand correctly, but we have to specify what the renderer should display (e.g. via SLD).

So als long as the styling format specifies the functionality for feature dependend styling, and a renderer properly implements the styling specification, everything should work fine.

E.g. SLD allows feature dependend styling via Expressions. So we can set different icons for different features within the same rule, by using the Expression directive within the IconSymbolizer. Any SLD renderer should then be able to display this.

jnewmoyer commented 2 years ago

I guess this is for conversions FROM geostyler styles TO sld documents. I'm not exactly sure how that's useful, our use case is the other direction - SLD -> OL - see https://github.com/geostyler/geostyler-openlayers-parser/pull/364#discussion_r785176584

jnewmoyer commented 2 years ago

I think that as long as the placeholders are converted from the SLD notation ${value} to the geostyler notation {{value}} then that would solve this. The placeholders then get replaced with the real values at render time. Ref: https://github.com/geostyler/geostyler-openlayers-parser/pull/364#discussion_r785731677

KaiVolland commented 4 months ago

@jnewmoyer @jansule is this discussion solved or outdated? If so please close this issue.

jnewmoyer commented 4 months ago

I'm pretty sure we are still doing special handling for the placeholders that aren't converted. However it could be fixed in the most recent release. We are a few versions behind.

jansule commented 4 months ago

Right, this issue is not yet solved. We do not (yet) support templating strings as image source.