Geographic Information Systems Asked by Vietphuong1001 on July 17, 2021
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:
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.
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
Answered by Andrea Aime on July 17, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP