3

I'm serving a layer via WMS that has multiple Polygons with transparency set to 30%. The polygons can overlap each other resulting in darker areas where the transparencies combine. Is it possible to prevent this?

UPDATE: Transparency is set via <CssParameter name="fill-opacity">0.5</CssParameter> of <Fill> element in SLD definition. The whole SLD looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
  xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
  <NamedLayer>
    <Name>plochaQ5ZU</Name>
    <UserStyle>
      <Name>Q5ZU</Name>
      <FeatureTypeStyle>

        <Rule>
          <Name>Q5ZU</Name>
          <Title>Q5ZU</Title>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#0070D4</CssParameter>
              <CssParameter name="fill-opacity">0.5</CssParameter>
            </Fill>
          </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

I'm using OpenLayers to display the layer.

4
  • How have you set the layer transparancy, including your SLD will help understand what you are trying to achieve and get you a better answer. What Client are you using to display the layers? P;ease update your question with this information. Cheers Commented Nov 21, 2013 at 7:19
  • Edited question. Commented Nov 21, 2013 at 9:42
  • Ok, you are styling Polygons on a Layer, not styling a Layer. Now, is there two layers being styled, or are you referring to the case where two Polygons on the same layer overlap each other? Commented Nov 22, 2013 at 0:31
  • Two polygons on the same layer. Commented Nov 22, 2013 at 10:50

1 Answer 1

1

You have two polygons that overlap with transparency set. This results in the overlaps appearing darker.

As far as I Know, the SLD for Polygons does not allow for partial transparencies within an individual Polygon area, you would have to truncate your polygons where the overlap occurred and create a new polygon to replace the overlapped area then style the new polygon to the same transparency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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