Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@turf/kinks
Advanced tools
@turf/kinks is a module in the Turf.js library that is used to detect self-intersections (kinks) in GeoJSON polygons. This is useful for validating and cleaning up spatial data to ensure that polygons are well-formed and do not contain any self-intersecting lines.
Detecting Kinks in Polygons
This feature allows you to detect self-intersections in a given GeoJSON polygon. The code sample creates a polygon with a self-intersection and uses the `turf.kinks` function to find and log the kinks.
const turf = require('@turf/turf');
const polygon = turf.polygon([[
[-12.034835, 8.901183],
[-12.060413, 8.899826],
[-12.03638, 8.873199],
[-12.034835, 8.901183]
]]);
const kinks = turf.kinks(polygon);
console.log(kinks);
JSTS (JavaScript Topology Suite) is a JavaScript library of spatial predicates and functions for processing geometry. It provides more comprehensive geometry operations compared to @turf/kinks, including robust algorithms for intersection, union, and difference operations.
Martinez Polygon Clipping is a library for performing boolean operations on polygons, such as union, intersection, and difference. While it does not specifically focus on detecting kinks, it can be used to handle complex polygon operations and ensure valid geometries.
Takes a linestring, multi-linestring, multi-polygon, or polygon and returns points at all self-intersections.
Parameters
featureIn
Feature<(LineString | MultiLineString | MultiPolygon | Polygon)> input featureExamples
var poly = turf.polygon([[
[-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);
//addToMap
var addToMap = [poly, kinks]
Returns FeatureCollection<Point> self-intersections
This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.
Install this module individually:
$ npm install @turf/kinks
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
6.4.0
@turf/boolean-point-on-line
Added an epislon
option to help in floating point comparison.
(PR https://github.com/Turfjs/turf/pull/2051 - Author @okcoker)@turf/line-slice-along
Fixed a bug where the offset distance equal to the length of the line
(PR https://github.com/Turfjs/turf/pull/2030 - Author @EricPKerr)
@turf/helpers
Fixed the conversion ratio for converting meters to yards and vice-versa
(PR https://github.com/Turfjs/turf/pull/2046 - Author @anotherhale)
@turf/center-median
Fixed a missing TS type import
(PR https://github.com/Turfjs/turf/pull/2044 - Author @Seairth)
`@turf/bezier-spline Fix a bug ensuring the spline result reaches the end of the input (PR https://github.com/Turfjs/turf/pull/2090 - Author @the-nemz)
@turf/transform-rotate
and @turf/ellipse
) Improve documentation for angle parameter
(PR https://github.com/Turfjs/turf/pull/2016 - Author @pasieronen)
@turf/line-chunk
Fix an invalid anchor
(PR https://github.com/Turfjs/turf/pull/2071 - Author @GraxMonzo)
@turf/distance
Enhance distance doco so supported inputs are clearer
(PR https://github.com/Turfjs/turf/pull/2032 - Author @rowanwins)
@turf/concave
Replace deprecated topojson dependency
(PR https://github.com/Turfjs/turf/pull/2037 - Author @elliots)
Work towards enabling TS Strict Mode (PR https://github.com/Turfjs/turf/pull/2053 - Author @mfedderly)
FAQs
turf kinks module
The npm package @turf/kinks receives a total of 735,095 weekly downloads. As such, @turf/kinks popularity was classified as popular.
We found that @turf/kinks demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.