Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
@turf/rhumb-bearing
Advanced tools
@turf/rhumb-bearing is a module from the Turf.js library that calculates the bearing between two geographical points along a rhumb line (a line of constant bearing). This is useful for navigation and mapping applications where you need to determine the direction from one point to another.
Calculate Rhumb Bearing
This feature calculates the rhumb bearing between two geographical points. The code sample demonstrates how to use the `rhumbBearing` function to find the bearing from point1 to point2.
const turf = require('@turf/turf');
const point1 = turf.point([0, 0]);
const point2 = turf.point([10, 10]);
const bearing = turf.rhumbBearing(point1, point2);
console.log(bearing);
Geolib is a library for geospatial calculations. It provides a variety of functions for distance, bearing, and other geographical calculations. Unlike @turf/rhumb-bearing, Geolib offers a broader range of geospatial utilities but may not be as specialized in rhumb line calculations.
Geodesy is a library for geodesic and rhumb line calculations. It offers detailed and precise methods for calculating distances, bearings, and other geospatial metrics. Compared to @turf/rhumb-bearing, Geodesy provides more comprehensive geodesic calculations but may be more complex to use.
Takes two points and finds the bearing angle between them along a Rhumb line i.e. the angle measured in degrees start the north line (0 degrees)
Parameters
start
(Geometry | Feature<Point> | Array<number>) starting Pointend
(Geometry | Feature<Point> | Array<number>) ending Pointfinal
[boolean] calculates the final bearing if true (optional, default false
)Examples
var point1 = {
"type": "Feature",
"properties": {
"marker-color": "#F00"
},
"geometry": {
"type": "Point",
"coordinates": [-75.343, 39.984]
}
};
var point2 = {
"type": "Feature",
"properties": {
"marker-color": "#00F"
},
"geometry": {
"type": "Point",
"coordinates": [-75.534, 39.123]
}
};
var bearing = turf.rhumbBearing(point1, point2);
//addToMap
point1.properties.bearing = bearing
point2.properties.bearing = bearing
var addToMap = [point1, point2]
Returns number bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)
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-bearing
Or install the Turf module that includes it as a function:
$ npm install @turf/turf
FAQs
turf rhumb-bearing module
The npm package @turf/rhumb-bearing receives a total of 565,150 weekly downloads. As such, @turf/rhumb-bearing popularity was classified as popular.
We found that @turf/rhumb-bearing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.