turf-buffer
turf-buffer copied to clipboard
turf.buffer creates Polygons with clockwise vertices.
I'm using the CDN version of turf in my browser, and creating buffers for User provided points, and saving them in the db; I realized that the geojson created was not conforming to the GeoJSON standard, (section 3.16) specifically, which states that
A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are counterclockwise, and holes are clockwise.
This can be replicated by running the following code:
var pt=turf.point([73,20]);
var buff=turf.buffer(pt, 2000, 'meters');
console.log(JSON.stringify(buff));
And then testing the output with http://geojsonlint.com/