turf kinks module
Takes a Polygon|polygon and returns Point|points at all self-intersections.
| parameter | type | description |
|---|---|---|
polygon |
Feature.<Polygon> | input polygon |
var poly = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [[
[-12.034835, 8.901183],
[-12.060413, 8.899826],
[-12.03638, 8.873199],
[-12.059383, 8.871418],
[-12.034835, 8.901183]
]]
}
};
var kinks = turf.kinks(poly);
var resultFeatures = kinks.intersections.features.concat(poly);
var result = {
"type": "FeatureCollection",
"features": resultFeatures
};
//=resultReturns FeatureCollection.<Point>, self-intersections
Requires nodejs.
$ npm install turf-kinks$ npm test