0

I have a layer using this SLD style:

<?xml version="1.0" encoding="ISO-8859-1"?>
<sld:StyledLayerDescriptor version="1.0.0"
                           xmlns="http://www.opengis.net/sld"
                           xmlns:sld="http://www.opengis.net/sld"
                           xmlns:gml="http://www.opengis.net/gml"
                           xmlns:ogc="http://www.opengis.net/ogc">
    <sld:NamedLayer>
        <sld:Name>name</sld:Name>
        <sld:UserStyle>
            <sld:Title>Name</sld:Title>
            <sld:Abstract>Name style</sld:Abstract>
            <sld:FeatureTypeStyle>
                <sld:Rule>
                 <sld:Name>Polygon</sld:Name>
                  <sld:Title>Polygon</sld:Title>
                   <sld:PolygonSymbolizer>
                    <sld:Fill>
                    <sld:CssParameter name="fill">
                        <ogc:Function name="env">
                            <ogc:Literal>color</ogc:Literal>
                            <ogc:Literal>#00FFFF</ogc:Literal>
                        </ogc:Function>
                    </sld:CssParameter>
                    <sld:CssParameter name="fill-opacity">
                        <ogc:Function name="env">
                            <ogc:Literal>opacity</ogc:Literal>
                            <ogc:Literal>0.8</ogc:Literal>
                        </ogc:Function>
                    </sld:CssParameter>
                    </sld:Fill>
                    <sld:Stroke>
                     <sld:CssParameter name="stroke">#00FFFF</sld:CssParameter>
                     <sld:CssParameter name="stroke-width">3</sld:CssParameter>
                    </sld:Stroke>
                   </sld:PolygonSymbolizer>
                </sld:Rule>          
            </sld:FeatureTypeStyle>
        </sld:UserStyle>
    </sld:NamedLayer>
</sld:StyledLayerDescriptor>

The stroke is not set as a variable above, just the fill (that is the plan)

When not sending the env parameters, GeoServer returns this: valid style

I am testing the URL here below, but it returns me an empty fill polygon when sending the customised variables

empty polygon

http://localhost:8080/geoserver/workspace/wms?
service=WMS&
version=1.1.0&
request=GetMap&
layers=workspace%3Alayer&
bbox=1%2C2%2C3%2C4&
styles=&
width=768&
height=397&
srs=EPSG%3A4326&
FORMAT=image%2Fpng&
env=color:#00FF00;opacity:0.3

What am I missing?

1
  • 1
    You need to turn up the logging level to developer in the global settings page, and then make the request again. Then edit your question with the relevant part of the log file.
    – Ian Turton
    Oct 6, 2022 at 15:36

1 Answer 1

1

it worked by replacing in the url:

env=color:#00FF00;opacity:0.3

'#' by %23

env=color:%2300FF00;opacity:0.3

All the examples I found were using either '#' or without it, so this type of error got unnoticed, until I realised it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.