0
<Rule>       
      <Title>EU-SPA</Title>
      <ogc:Filter>
      <PropertyIsEqualTo>
         <PropertyName>BEWERT2006</PropertyName>
         <Literal>EU-SPA</Literal>
      </PropertyIsEqualTo>
      </ogc:Filter>
      <PolygonSymbolizer>
        <Fill>
          <GraphicFill><Graphic>
            <Mark>
              <WellKnownName>shape://slash</WellKnownName>
              <Fill>
                <CssParameter name="fill">#66ff33</CssParameter>
                <CssParameter name="fill-opacity">.7</CssParameter>
              </Fill>
              <Stroke>
                <CssParameter name="stroke">#000000</CssParameter>
                <CssParameter name="stroke-width">1</CssParameter>
              </Stroke>
              <Stroke />
            </Mark><Size>5</Size>
            </Graphic></GraphicFill>
        </Fill>
        <Stroke/>
      </PolygonSymbolizer>
    </Rule>

I would like to have a square with slanted lines inside in which the fill must be one colour and the stroke must be another. I have written this code to make it run but it just shows without any colour. Can somebody share some ideas?

1 Answer 1

3

shape://slash is just a line, it cannot be filled. But a rule can contain multiple symbolizers that will be superimposed. Try this for example:

<Rule>       
      <Title>EU-SPA</Title>
      <ogc:Filter>
      <PropertyIsEqualTo>
         <PropertyName>BEWERT2006</PropertyName>
         <Literal>EU-SPA</Literal>
      </PropertyIsEqualTo>
      </ogc:Filter>
      <PolygonSymbolizer>
         <Fill>
            <CssParameter name="fill">#66ff33</CssParameter>
            <CssParameter name="fill-opacity">.7</CssParameter>
         </Fill>
      </PolygonSymbolizer>
      <PolygonSymbolizer>
        <Fill>
          <GraphicFill><Graphic>
            <Mark>
              <WellKnownName>shape://slash</WellKnownName>
              <Stroke>
                <CssParameter name="stroke">#000000</CssParameter>
                <CssParameter name="stroke-width">1</CssParameter>
              </Stroke>
              <Stroke />
            </Mark><Size>5</Size>
            </Graphic></GraphicFill>
        </Fill>
        <Stroke/>
      </PolygonSymbolizer>
    </Rule>
1
  • Thank you :). It worked like a charm.
    – Pgm-Mastr
    Dec 9, 2020 at 12:36

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.