What is @turf/rhumb-destination?
@turf/rhumb-destination is a module from the Turf.js library that allows you to calculate the destination point given a starting point, distance, and bearing using rhumb lines. Rhumb lines are paths of constant bearing, which are useful for navigation and mapping applications.
What are @turf/rhumb-destination's main functionalities?
Calculate Rhumb Line Destination
This feature allows you to calculate the destination point from a given starting point, distance, and bearing using rhumb lines. The code sample demonstrates how to use the `rhumbDestination` function to find a point 50 kilometers east of the starting point.
const turf = require('@turf/turf');
const start = turf.point([-75.343, 39.984]);
const distance = 50;
const bearing = 90;
const units = 'kilometers';
const destination = turf.rhumbDestination(start, distance, bearing, {units: units});
console.log(destination);
Other packages similar to @turf/rhumb-destination
geolib
Geolib is a library for geospatial calculations. It provides functions for distance calculations, finding the center of a collection of points, and more. Unlike @turf/rhumb-destination, Geolib does not specifically focus on rhumb lines but offers a broader range of geospatial utilities.
geodesy
Geodesy is a library for geodesic calculations. It includes functions for calculating distances, bearings, and destinations on the Earth's surface. While it provides more general geodesic calculations, it does not specifically focus on rhumb lines like @turf/rhumb-destination.
spherical-geometry-js
Spherical Geometry is a library for performing spherical geometry calculations, including distance and area calculations on the Earth's surface. It focuses on spherical rather than rhumb line calculations, making it different from @turf/rhumb-destination.
@turf/rhumb-destination
rhumbDestination
Returns the destination Point having travelled the given distance along a Rhumb line from the
origin Point with the (varant) given bearing.
Parameters
-
origin
Coord starting point
-
distance
number distance from the starting point
-
bearing
number varant bearing angle ranging from -180 to 180 degrees from north
-
options
Object Optional parameters (optional, default {}
)
options.units
string can be degrees, radians, miles, or kilometers (optional, default 'kilometers'
)options.properties
Object translate properties to destination point (optional, default {}
)
Examples
var pt = turf.point([-75.343, 39.984], {"marker-color": "F00"});
var distance = 50;
var bearing = 90;
var options = {units: 'miles'};
var destination = turf.rhumbDestination(pt, distance, bearing, options);
var addToMap = [pt, destination]
destination.properties['marker-color'] = '#00F';
Returns Feature<Point> Destination point.
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.
Installation
Install this single module individually:
$ npm install @turf/rhumb-destination
Or install the all-encompassing @turf/turf module that includes all modules as functions:
$ npm install @turf/turf