Skip to content

turf-junkyard/turf-kinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

turf-kinks

build status

turf kinks module

turf.kinks(polygon)

Takes a Polygon|polygon and returns Point|points at all self-intersections.

Parameters

parameter type description
polygon Feature.<Polygon> input polygon

Example

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
};

//=result

Returns FeatureCollection.<Point>, self-intersections

Installation

Requires nodejs.

$ npm install turf-kinks

Tests

$ npm test

About

Find all self-intersections of a given Polygon

Resources

License

Stars

Watchers

Forks

Packages

No packages published