geostyler / geostyler-sld-parser

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

Does the parser support UnitOfMeasure? #892

Open ghost opened 9 months ago

ghost commented 9 months ago

Hello, I wonder whether the parser supports uom in the Symbolizer element, I got a SLD 1.1 style containing this LineSymbolizer

          <se:LineSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
            <se:Stroke>
              <se:SvgParameter name="stroke">#333333</se:SvgParameter>
              <se:SvgParameter name="stroke-width">1600</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">round</se:SvgParameter>
              <se:SvgParameter name="stroke-linecap">round</se:SvgParameter>
            </se:Stroke>
          </se:LineSymbolizer>

and I get verrrry wide lines so that the screen is filled. Another LineSymbolizer in the same style without uom and a small width works fine. I read the SLD style and wrote it to a MB Style and displayed it in MapLibre.

KaiVolland commented 9 months ago

Yes, you can pass it to the constructor of the Parser: https://github.com/geostyler/geostyler-sld-parser/blob/master/src/SldStyleParser.ts#L61-L68

It requires SLDVersion to be set to 1.1.0.

But i'm actually not sure if the mapbox-styler-parser already supports this.

You might also want to try your style in the demo.

ghost commented 9 months ago

Thanks. I tried setting the version to 1.1.0. The symbolizerUnits setting is a global setting in the ctor, right? My style has a per symbolizer setting (some use it and some not). That works in geostyler preview. The SLDparser readStyle output has a 1600 width and no hint of a changed unit. should there be a unit member somewhere?

I tried the demo, changed the format to SLD 1.1, the units to meter and increased the width to 100 but I got a very wide line. Looks as if it doesn't work here, too.

KaiVolland commented 9 months ago

Ok. We will leave this issue open then. This feature is more or less in an experimental stage. Would be helpful if you could open a PR with a failing SLD example in /data/slds/1.1.

ghost commented 9 months ago

PR is #893 for symbolizer-specific SLD. Paste it into the demo to see the result.