NieuwlandGeo/SLDReader

OLStyler stroke of polygon is visible around tiles when greater than tile buffer (tiled maps)

allyoucanmap opened this issue · 1 comments

When stroke width is greater than tile buffer (or tile buffer is small) the tile grid is visible.
Current SLDReader implementation creates a polygon style from a single OL Style source and the stroke is applied on top of fill.
SLD uses as test case.

<UserStyle>
 <FeatureTypeStyle>
  <Rule>
   <PolygonSymbolizer>
    <Fill>
     <CssParameter name="fill">#acdd7a</CssParameter>
    </Fill>
    <Stroke>
     <CssParameter name="stroke">#333</CssParameter>
     <CssParameter name="stroke-width">50</CssParameter>
    </Stroke>
   </PolygonSymbolizer>
  </Rule>
 </FeatureTypeStyle>
</UserStyle>

Image below shows what happen when stroke is greater than tile buffer.

actual_imp

A possible solution could be to split polyon style in an array that apply fill on top of stoke.
Here master...allyoucanmap:polygon-stroke the code implemented to get the result you can see in the below image

possible_soultion

There are still two issues in the proposed solution:

  • stroke-width needs to be multiply by 2 to be the right size when fill is rendered on top of it
  • if fill is missing the issue is still there as in the following image

without_fill

If this solution master...allyoucanmap:polygon-stroke could work I can provide a PR.

According to the SLD spec, stroke should always be rendered on top of the fill inside a single PolygonSymbolizer.

As a workaround, you can add two symbolizers inside a rule, a symbolizer with only a fill following a symbolizer with only a stroke.