bearing library
Calculates the geographic bearing (and rhumb bearing) between two Points.
Classes
- BBox
-
Please make sure, you arrange your parameters like this:
Longitude 1, Latitude 1, Altitude 1 (optional), Longitude 2, Latitude 2, Altitude 2 (optional)
You can either specify 4 or 6 parameters
If you are using the default constructor with two dimensional positions (lng + lat only), please use the constructor like this:
BBox(lng1, lat1, lng2, lat2); - CoordinateType
- Coordinate types, following https://tools.ietf.org/html/rfc7946#section-4
-
Feature<
T extends GeometryObject> - Feature, as specified here https://tools.ietf.org/html/rfc7946#section-3.2
-
FeatureCollection<
T extends GeometryObject> - FeatureCollection, as specified here https://tools.ietf.org/html/rfc7946#section-3.3
- GeoJSONObject
- GeometryCollection
- GeometryCollection, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.8
- GeometryObject
-
GeometryType<
T> - LineString
- LineString, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.4
- MultiLineString
- MultiLineString, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.5
- MultiPoint
- MultiPoint, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.3
- MultiPolygon
- MultiPolygon, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.7
- Point
- Point, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.2
- Polygon
- Polygon, as specified here https://tools.ietf.org/html/rfc7946#section-3.1.6
- Position
- Please make sure, you arrange your parameters like this:
Enums
Functions
-
bearing(
Point start, Point end, {bool calcFinal = false}) → num - Takes two Points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees) For example:
-
bearingRaw(
Position start, Position end, {bool calcFinal = false}) → num -
calculateFinalBearing(
Point start, Point end) → num - Calculates Final Bearing
-
calculateFinalBearingRaw(
Position start, Position end) → num -
calculateRhumbBearing(
Position from, Position to) → num - Returns the bearing from ‘this’ Point to destination Point along a rhumb line. Adapted from Geodesy: https://github.com/chrisveness/geodesy/blob/master/latlon-spherical.js Returns Bearing in degrees from north. example
-
rhumbBearing(
Point start, Point end, {bool kFinal = false}) → num -
Takes two Point and finds the bearing angle between them along a Rhumb line
i.e. the angle measured in degrees start the north line (0 degrees)
kFinalcalculates the final bearing if true. Returns bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise) example: