How can I create a custom border to multipolygon with leaflet? I would like to have inner border black and outer red or vice versa.
Example picture to show what I mean:
Is there any way to do this?
How can I create a custom border to multipolygon with leaflet? I would like to have inner border black and outer red or vice versa.
Example picture to show what I mean:
Is there any way to do this?
You can use Leaflet Polyline Offset plugin to draw a duplicate polyline offset by a specified number of pixels and achieve somewhat the desired effect.
There is however a "bug" at the polyline start and end, due to the fact that it is offset but not shorten / extended to close the gap with the beginning of the polyline.
Using an
L.rectangle
or anL.polygon
shows a different bug, where the last segment is not offset. That could be a room for improvement for the plugin, if someone has the dedication to have a look, correct the bug and submit a Pull Request! :-)Demo: http://jsfiddle.net/3v7hd2vx/42/