2

I have some polygons (country borders) and using the query parameter "transparent=true" in my request, I can see what is behind the layer, where no border is. That is great!

On the other hand, I have to style the border and I should not do it on the server side. So I send an SLD with my map request. Styling the borders, filling the polygons with color, that works fine.

Working with requests from the SLD Cookbook like this one

 <FeatureTypeStyle>
     <Rule>
       <PolygonSymbolizer>
         <Fill>
           <CssParameter name="fill">#000080</CssParameter>
           <CssParameter name="fill-opacity">0</CssParameter>
         </Fill>
         <Stroke>
           <CssParameter name="stroke">#FFFFFF</CssParameter>
           <CssParameter name="stroke-width">2</CssParameter>
         </Stroke>
       </PolygonSymbolizer>
     </Rule>
   </FeatureTypeStyle>

do not work for me. I have still the white background. I also tried to leave <CssParameter name="fill">#000080</CssParameter> and also the whole fill-part out. But no success.

I also tried to combine the &transparent=true parameter and the SLD. But that was also without success.

Last but not least I tried to find some configuration on the server side. Thought maybe I can set the transparency per default, so If I want to fill the polygon I can explicitly say this with SLD. But as you might already guess...no success.

2

The white you are seeing is the background colour of the map, if you don't specify transparent=true or set the bgcolor parameter GeoServer will use a white background. This background can be covered by a polygon fill but will show through where there is no fill set or where the fill is transparent (opacity=0).

So you need to send your SLD as before (with no fill set is easiest for the renderer) and specify that you want a transparent background by setting transparent=true in the request.

  • Your answer worked for me with rewriting my request (= Writing version=1.3.0 is not working. But it works with version=1.3 – Niklas Oct 24 '17 at 13:51
  • 1
    Please tell more about that version=1.3.0 vs. version=1.3 issue. It would be excellent if you could write requests that work against the topp:states layer that comes with the default installation. – user30184 Oct 27 '17 at 13:35
  • @user30184 my guess is that 1.3.0 switches the axis order (correctly) so if the bbox isn't switched so nothing shows up, 1.3 is being negotiated down to 1.1.0 (maybe) and so everything works – Ian Turton Oct 27 '17 at 13:53

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.