1

I have SLD style and I would like to transform it to MBstyle in GeoServer. I have no idea how set the stroke-width in MBStyle for a polygon that also has a fill?

My SLD style:

         <Rule>
           <Name>polygon1</Name>
           <Title>polygon1</Title     
           <PolygonSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
             <Fill>
               <CssParameter name="fill">#ce4c00</CssParameter>
             </Fill>
             <Stroke>
               <CssParameter name="stroke">#000000</CssParameter>
               <CssParameter name="stroke-width">2</CssParameter>
             </Stroke>
           </PolygonSymbolizer>
         </Rule>

Now, I have:

{ "version": 8, "name": "polygon1", "layers": [ { "id": "polygon1", "type": "fill", "paint": { "fill-color": "#ce4c00", "fill-outline-color": "#000000" } }

] }

But I can't find any information how to do: width of 'outline'

3
  • Welcome to Geographic Information Systems! Welcome to GIS SE! We're a little different from other sites; this isn't a discussion forum but a Q&A site. Your questions should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. Please check out our short tour for more about how the site works
    – Ian Turton
    Feb 21, 2023 at 16:19
  • What have you tried?
    – Ian Turton
    Feb 21, 2023 at 16:20
  • sorry, already edited my post
    – hipaka
    Feb 21, 2023 at 17:42

1 Answer 1

2

The GeoServer documentation https://docs.geoserver.org/2.22.x/en/user/styling/mbstyle/cookbook/polygons.html has an example about fill-outline with a notice

This example is similar to the Simple polygon example above, with the addition of fill-outline paint parameter (line 9). Line 9 also sets the color of stroke to white ('#FFFFFF'), the "fill-outline-color" can only be 1 pixel, a limitation of MBStyle.

The MapBox style specification indeed defines only "fill-outline-color" but no way for setting the width. Obviously it is impossible. A workaround is make a separate line layer from the boundary and set the width with https://docs.mapbox.com/mapbox-gl-js/style-spec/layers/#paint-line-line-width.

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.