6.5.0 • Published 17 days ago

@turf/bearing v6.5.0

Weekly downloads
288,491
License
MIT
Repository
github
Last release
17 days ago

@turf/bearing

bearing

Takes two points and finds the geographic bearing between them, i.e. the angle measured in degrees from the north line (0 degrees)

Parameters

  • start Coord starting Point
  • end Coord ending Point
  • options Object Optional parameters (optional, default {})
    • options.final boolean calculates the final bearing if true (optional, default false)

Examples

var point1 = turf.point([-75.343, 39.984]);
var point2 = turf.point([-75.534, 39.123]);

var bearing = turf.bearing(point1, point2);

//addToMap
var addToMap = [point1, point2]
point1.properties['marker-color'] = '#f00'
point2.properties['marker-color'] = '#0f0'
point1.properties.bearing = bearing

Returns number bearing 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.

Installation

Install this module individually:

$ npm install @turf/bearing

Or install the Turf module that includes it as a function:

$ npm install @turf/turf
canibuild-leaflet-component@bimenergy/be-format-utilsairsiders-mapping-toolgeojson-path-finder-junctions@infinitebrahmanuniverse/nolb-_tur@hopara/hopara@everything-registry/sub-chunk-941@bmap-turf/turfocad2geojson-demoproximiio-js-libraryosm-edit-bundleopenpanos-clientxbsj-rendererxbsj-xe2yymap-turftongmap-componentturf-diametertallygo-jsrk-web-mapsharedstreets@conveyal/analysis-ui@iep-kit/mapcrosslines@any-routing/annotation-plugin@headstorm/hs-react-gis@hongtu-next/coredataset-to-tileset@kyfe/kyemap-jsgas.glgas3d.gl@mapquest/directions@mybus/spatialgeohashes-alonggeohashes-betweengeobuffergeojson-minimum-bounding-rectanglegisviewer-vue2-arcgisgisviewer-vue2-cesium@mapbox/carmen@mapbox/carmen-private@mapbox/fid@mapbox-controls/image@mblomdahl/mapbox-gl-circle@nebula.gl/edit-modes@nebula.gl/layersgtfs-utilsgeo-data-integration@loudsrl/turf@opentripplanner/transitive-overlayhafas-find-triphafas-find-trips@ragone/edit-modesigeo-mapjoymap-jsleaflet-truesizelibre-routingluke.gl@turf/along@turf/angle@turf/midpoint@turf/nearest-point-on-line@turf/point-on-line@turf/point-to-line-distance@turf/line-slice-along@turf/directional-mean@turf/turfmdh-web-map@varlab-ucf/nebula.gl@varlab-ucf/nebulagl-edit-modes@varlab-ucf/nebulagl-layersmapbox-gl-draw-rotate-modemapbox-gl-draw-scale-rotatemapbox-gl-circlemapbox-gl-circle-forkedmapbox-draw-expandmgl-circle-radiusmini-tokyo-3d@v-mapboxgl/plugin-arrow-line-layer@v-mapboxgl/plugin-cluster-layer@whitewater-guide/clients@zalastax/nolb-_turfield-of-viewnebula.glaeroscoreagentmapsalt-route-labeller
7.0.0-alpha.114

17 days ago

7.0.0-alpha.113

2 months ago

7.0.0-alpha.111

2 months ago

7.0.0-alpha.110

3 months ago

7.0.0-alpha.1

6 months ago

7.0.0-alpha.2

6 months ago

7.0.0-alpha.0

1 year ago

6.5.0

3 years ago

6.4.0

3 years ago

6.3.0

3 years ago

6.2.0

3 years ago

6.2.0-alpha.3

3 years ago

6.2.0-alpha.2

4 years ago

6.2.0-alpha.0

4 years ago

6.2.0-alpha.1

4 years ago

6.0.1

6 years ago

6.0.0

6 years ago

5.1.5

6 years ago

5.1.0

6 years ago

5.0.4

6 years ago

5.0.0

6 years ago

4.7.3

7 years ago

4.7.1

7 years ago

4.7.0

7 years ago

4.6.0

7 years ago

4.5.2

7 years ago

4.5.1

7 years ago

4.5.0

7 years ago

4.4.0

7 years ago

4.3.0

7 years ago

4.2.0

7 years ago

4.1.0

7 years ago

4.0.1

7 years ago

4.0.0

7 years ago

3.14.0

7 years ago

3.13.0

7 years ago

3.10.0

7 years ago

3.7.5

7 years ago

3.7.3

7 years ago

3.7.0

7 years ago

3.6.3

7 years ago

3.5.2

8 years ago

3.3.3

8 years ago

3.1.1

8 years ago

3.0.16

8 years ago

3.0.15

8 years ago