I try to style a LineString in a Mapbox Map through L.Geojson and all the style properties I could find are: fillColor, colour, weight, opacity. Does anyone know if there is something else? For example to add a border width, a colour to this border, dashed the line, etc. ?

1 Answer 1

  • title
  • description
  • marker-size
  • marker-symbol
  • marker-color
  • stroke
  • stroke-opacity
  • stroke-width
  • fill
  • fill-opacity

Mapbox.js uses the simplestyle spec. That's where you can find out more about defaults and accepted values.

Adding a dashed line is a little more complicated, see dashArray in the leaflet documentation which will work with mapbox.js.

  • Thanks for your answer. In my case of a LineString (or PolyLine for leaflet) loaded with L.geojson, the correct answer is the Class Path.
    – Inclanfunk
    Mar 22, 2014 at 13:02
  • 1
    So how exactly can one add a border to a line string in Leaflet? Can you provide an example?
    – araichev
    May 2, 2014 at 3:29
  • @araichev I don't know if you've figured out how to do that or not, but the way we are hacking it is to draw the GeoJSON once with an opaque background two pixels wider than the path, and then again with a semi-opaque background of our set color. Hacky, but it works. Aug 25, 2015 at 19:09

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.