Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@turf/rhumb-distance
Advanced tools
@turf/rhumb-distance is a module from the Turf.js library that calculates the rhumb line distance between two geographical points. A rhumb line is a path of constant bearing, which is different from the shortest path (great-circle distance) on a sphere. This package is useful for applications that require consistent bearing, such as navigation and mapping.
Calculate Rhumb Distance
This feature calculates the rhumb line distance between two geographical points. The `units` option allows you to specify the unit of measurement, such as miles, kilometers, etc.
const turf = require('@turf/turf');
const point1 = turf.point([-75.343, 39.984]);
const point2 = turf.point([-75.534, 39.123]);
const options = { units: 'miles' };
const distance = turf.rhumbDistance(point1, point2, options);
console.log(distance);
Geolib is a library for geospatial calculations. It provides various methods for distance calculations, including great-circle distance and rhumb line distance. Compared to @turf/rhumb-distance, Geolib offers a broader range of geospatial functions but may not be as specialized in rhumb line calculations.
Geodesy is a library that provides tools for geodesic calculations. It includes methods for calculating distances, bearings, and other geospatial properties. While it offers comprehensive geodesic calculations, it may require more configuration compared to the straightforward usage of @turf/rhumb-distance.
Calculates the distance along a rhumb line between two points in degrees, radians, miles, or kilometers.
Parameters
from
Coord origin pointto
Coord destination pointoptions
Object? Optional parameters
options.units
string can be degrees, radians, miles, or kilometers (optional, default "kilometers"
)Examples
var from = turf.point([-75.343, 39.984]);
var to = turf.point([-75.534, 39.123]);
var options = {units: 'miles'};
var distance = turf.rhumbDistance(from, to, options);
//addToMap
var addToMap = [from, to];
from.properties.distance = distance;
to.properties.distance = distance;
Returns number distance between the two points
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/rhumb-distance
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
6.5.0
@turf/points-with-polygon
Add MultiPoint support
(PR https://github.com/Turfjs/turf/pull/2137 - Author @twelch)@turf/dissolve
Complete rewrite of the dissolve module to resolve many bugs
(PR https://github.com/Turfjs/turf/pull/2110 - Author @rowanwins)
@turf/mask
Complete rewrite of the mask module to resolve many bugs
(PR https://github.com/Turfjs/turf/pull/2130 - Author @rowanwins)
@turf/boolean-valid
Add missing dependency to
(PR https://github.com/Turfjs/turf/pull/2094 - Author @rycgar)
@turf/boolean-overlap
Improve clarity
(PR https://github.com/Turfjs/turf/pull/2133 - Author @patrickbrett)FAQs
turf rhumb-distance module
The npm package @turf/rhumb-distance receives a total of 943,764 weekly downloads. As such, @turf/rhumb-distance popularity was classified as popular.
We found that @turf/rhumb-distance 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
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.