Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@turf/boolean-touches
Advanced tools
@turf/boolean-touches is a module from the Turf.js library that provides geospatial analysis tools. This specific package is used to determine if two geometries touch each other, meaning they have at least one boundary point in common but do not overlap.
Check if two geometries touch
This feature allows you to check if two geometries touch each other. In the code sample, a point and a line are defined, and the function checks if the point touches the line. The result is true because the point is on the line's boundary.
const turf = require('@turf/boolean-touches');
const point = turf.point([1, 1]);
const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
const touches = turf(point, line);
console.log(touches); // true
JSTS is a JavaScript library of spatial predicates and functions for processing geometry. It is similar to @turf/boolean-touches in that it can determine spatial relationships between geometries, including whether they touch. JSTS is more comprehensive, offering a wider range of geometric operations and predicates.
Geolib is a library for geospatial operations in JavaScript. While it focuses more on distance and area calculations, it also provides some basic spatial relationship checks. Compared to @turf/boolean-touches, Geolib is less specialized in topological relationships but can be used for simpler geospatial tasks.
Boolean-touches true if none of the points common to both geometries intersect the interiors of both geometries.
feature1
(Geometry | Feature<any>) GeoJSON Feature or Geometryfeature2
(Geometry | Feature<any>) GeoJSON Feature or Geometryvar line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
var point = turf.point([1, 1]);
turf.booleanTouches(point, line);
//=true
Returns boolean true/false
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 single module individually:
$ npm install @turf/boolean-touches
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf
FAQs
turf boolean-touches module
The npm package @turf/boolean-touches receives a total of 87,642 weekly downloads. As such, @turf/boolean-touches popularity was classified as popular.
We found that @turf/boolean-touches 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.