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

GetStyles SLD does not include LAYER's Opacity value #4340

Closed
myGitHubUName opened this issue Jun 8, 2012 · 3 comments
Closed

GetStyles SLD does not include LAYER's Opacity value #4340

myGitHubUName opened this issue Jun 8, 2012 · 3 comments

Comments

@myGitHubUName
Copy link

In creating the GetStyles response, the code should look at the LAYER's OPACITY as well as the CLASS STYLE's OPACITY to determine whether the fill-opacity CssParameter should be added to the Rule. To be consistent with the getMap and getLegendGraphic requests, the LAYER's OPACITY should override the CLASS STYLE's definition (should they both exist).

On our 6.0.1 version of Mapserver, we have introduced the code below in mapogcsld.c's msSLDGeneratePolygonSLD (in the section where it's dealing with the fill-opacity). I don't know if it's good enough or if there are farther-reaching ramifications to introducing this change than we are aware of. I simply provide it here as a starting point to illustrate what I'm talking about.

    if(psLayer->opacity != 100 && psLayer->opacity != -1) {
        snprintf(szTmp, sizeof(szTmp),
              "<%s name=\"fill-opacity\">%.2f</%s>\n",
              sCssParam, (float)psLayer->opacity/100, sCssParam);
        pszSLD = msStringConcatenate(pszSLD, szTmp);
     }
     else if(psStyle->color.alpha != 255 && psStyle->color.alpha!=-1) {
        snprintf(szTmp, sizeof(szTmp),
              "<%s name=\"fill-opacity\">%.2f</%s>\n",
              sCssParam, (float)psStyle->color.alpha/255, sCssParam);
        pszSLD = msStringConcatenate(pszSLD, szTmp);
     } 

Similarly, stroke-opacity should be addressed; for both the PolygonSymbolizer (outlines) and LineSymbolizer (related issues of which are discussed in: #4132)

@myGitHubUName
Copy link
Author

Background discussion and example provided at:

I tried adding the examples in this GitHub editor but they got formatted all wrong (particularly the SLD results). I hope this referencing will do.

@jratike80
Copy link

Seems to be true also in Mapserver 7.0, Opacity setting is not written into SLD.

@jratike80
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants