[GIS] Generate pattern inside polygon in Leaflet

javascriptleafletpolygon

I'm new to Leaflet and mapping. I'm currently looking for solutions to how I can autogenerate a line pattern inside a polygon drawn on the map with a pre defined distance between each line.

Does anyone have any suggestion to how I can achieve this?

Best Answer

This Leaflet plugin lets you do exactly that:

Leaflet.pattern
Provides the ability to use SVG patterns as backgrounds for Leaflet Paths.

Options include:

  • X Offset
  • Y Offset
  • Width
  • Height
  • Angle

From the stripe pattern example:

enter image description here

Related Question