1

If I add a stroke to a polygon SLD style, I get something that extends over both sides of the polygon boundary like this:

enter image description here

I want to highlight certain polygons, some without drawing anything over their area, others without drawing anything over their neighbors. So the stroke should only be on the inside OR outside instead like in these:

enter image description here

How can I achieve this in GeoServer SLD in an easy, fast and hopefully non-hacky way? I need to be able to specify the width in "drawing units", not my geometry's coordinate system units so the suggestions from the similar Line stroke offset in Geoserver do not apply.

1

You can use <PerpendicularOffset>5</PerpendicularOffset>

A positive value places the offset line on the left of the line. In the example above the offset is 5 pixels. You can then specify the line thickness, so if you want an inner line 10 pixels wide and touching the perimeter, I would try setting the offset to 5 and the line thickness to 10. A negative value places the offset on the other side of the line.

See the documentation here for 'Offset Inner Lines'. (I have a feeling this may be a new feature since the previous thread you reference was written).

| improve this answer | |
  • Unfortunately that is a GeoServer 2.9 addition, I am stuck on 2.8.2 for the time being. :( – bugmenot123 May 24 '16 at 9:29
2

For GeoServer 2.8.x you can use compositing to achieve a "inner stroke" effect, see here: http://docs.geoserver.org/2.8.x/en/user/styling/sld-extensions/composite-blend/example.html

| improve this answer | |

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.