Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sld parser potential issue with OpenLayers parser #605

Open
Eullar opened this issue Jun 1, 2022 · 1 comment
Open

Sld parser potential issue with OpenLayers parser #605

Eullar opened this issue Jun 1, 2022 · 1 comment
Labels
question Further information is requested

Comments

@Eullar
Copy link

Eullar commented Jun 1, 2022

Question

Hey. I think I found an issue when working with Sld and OpenLayers parsers. Sld parses fill-opacity to fillOpacity field:

case 'fill-opacity':
          fillSymbolizer.fillOpacity = parseFloat(value);
          break;

However later on opacity field is also set:

if (!fillSymbolizer.color) {
      fillSymbolizer.opacity = 0;
    }

I also found out that in OpenLayers parser, when creating Polygon symbolizer from Fill symbolizer, opacity field is used, which won't work because the opacity will be null because the color is set, therefor the color will always be solid:

 getOlPolygonSymbolizerFromFillSymbolizer(symbolizer: FillSymbolizer): OlStyleFill {
    let fill = symbolizer.color ? new this.OlStyleFillConstructor({
      color: (symbolizer.opacity !== null && symbolizer.opacity !== undefined) ?
        OlStyleUtil.getRgbaColor(symbolizer.color, symbolizer.opacity) : symbolizer.color
    }) : null;

Am I correct in thinking that this is not right? If this is an issue, is it an issue of Sld or OpenLayers parser?

@Eullar Eullar added the question Further information is requested label Jun 1, 2022
@KaiVolland
Copy link
Contributor

Hey @Eullar,

thanks for the report.

  1. Actually you could arguee, that an opacity without a fillcolor does not make sence, but I think you're right and we should not modify this. Maybe you could open a PR with a (failing) test that contains the input and expected output?

  2. I think you're also right about the OLParser. Would be nice if you could open an issue here. And same as for the bug here. An PR with a failing test for the input and expected output would be very helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
No open projects
Status: Todo
Development

No branches or pull requests

3 participants