Skip to content

Instantly share code, notes, and snippets.

@pborissow
pborissow / line2Polygon.md
Last active July 23, 2020 14:06 — forked from kekscom/Thick Line to Polygon JS
A JavaScript method to turn thick lines into polygons

Line2Polygon

Creates a polygon around a linestring. Provides an option to vary the thickness. Usage:

    var path = [ [0, 0], [25, 25], [13, 13] ];
    var width = 5; //or an array for each line segment [ 5, 10, 15 ]
    var poly = line2Polygon(path, width);

Credit: https://gist.github.com/kekscom/4194148