1

I want to fill the polygon in GeoServer with 2 parallel lines pattern. Example: 1 continuous and 1 dash line. For example like this image:

Text

I can fill the polygon in GeoServer with shape://slash. And combine 2 block , I can create a pattern with 2 lines. But I couldn't offset the second line to make them parallel (tried with perpendicularoffset but always got errors).

<PolygonSymbolizer>
  <Fill>
   <GraphicFill>
     <Graphic>
       <Mark>
         <WellKnownName>shape://slash</WellKnownName>
         <Stroke>
           <CssParameter name="stroke">#e31a1c</CssParameter>
           <CssParameter name="stroke-width">2</CssParameter>
         </Stroke>
       </Mark>
       <Size>20</Size>
     </Graphic>
   </GraphicFill>
 </Fill>
</PolygonSymbolizer>

<PolygonSymbolizer>
  <Fill>
   <GraphicFill>
     <Graphic>
       <Mark>
         <WellKnownName>shape://slash</WellKnownName>
         <Stroke>
           <CssParameter name="stroke">#001cac</CssParameter>
           <CssParameter name="stroke-width">2</CssParameter>
           <CssParameter name="stroke-dasharray">5 2</CssParameter>
         </Stroke>

        <!-- Not sure how to insert Offset correctly -->
         <PerpendicularOffset>5</PerpendicularOffset>

       </Mark>
       <Size>20</Size>
     </Graphic>
   </GraphicFill>
 </Fill>
</PolygonSymbolizer>

The sample use perpendicularoffset seem only work with stroke (boundary of polygons).

So is there anyway I can define a sld file for that purpose?

I can fill with .svg file to meet the requirement but the disadvantage is the difficult to change color of line. In both ArcGIS & QGIS, I can easily define the pattern like that, so I don't understand why it seems not possible to do in GeoServer.

3
  • 1
    can you add a picture of what you are trying to do and some SLD to show what you have tried? but from the sound of it perpendicular offset would not be valid in a mark hence the errors
    – Ian Turton
    Jan 29, 2021 at 10:51
  • Sure, this is the pattern I want to define in .sld file: image And below is the my SLD: link text Jan 30, 2021 at 2:13
  • please use the edit link to update your question rather than a transient comment
    – Ian Turton
    Jan 30, 2021 at 11:44

1 Answer 1

1

There is no way to offset a fill in GeoServer (why? because no one sponsored that functionality yet, but you can do something about it, either by contributing to the rendering engine in GeoTools, or sponsoring a commercial support provider to implement the functionality)

However, you can also change the colors in a SVG if you want: https://docs.geotools.org/latest/userguide/library/render/svg.html#parameter-extension

Your Answer

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

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