7.2.0 • Published 7 months ago

@turf/bearing v7.2.0

Weekly downloads
288,491
License
MIT
Repository
github
Last release
7 months 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-941mdh-web-maptallygo-jsxbsj-rendererxbsj-xe2vtxf-renderervtxf-xe2@conveyal/analysis-uijoymap-js@bdh-gis/mapbox-gl-measureugis-coreturf-diametertongmap-component@any-routing/annotation-plugin@aegirmaps/aegir-js-sdk@bmap-turf/turf@deck.gl-community/editable-layersyymap-turfvin3box@ragone/edit-modes@headstorm/hs-react-gis@hongtu-next/core@iep-kit/map@kyfe/kyemap-js@loudsrl/turf@mybus/spatial@mapbox/carmen@mapbox/carmen-private@mapquest/directions@mapbox/fid@mapbox-controls/image@nebula.gl/edit-modes@nebula.gl/layers@dynatrace/strato-geo@mblomdahl/mapbox-gl-circle@opentripplanner/transitive-overlaymy3dtiles-libmgl-circle-radiusmini-tokyo-3dopenpanos-clientosm-edit-bundleocad2geojson-demonebula.glrk-web-mapproximiio-js-librarysharedstreetsgisviewer-vue2-arcgisgisviewer-vue2-cesiumgisviewer-vue3-arcgisigeo-mapgtfs-utilshafas-find-triphafas-find-tripslibre-routingluke.glmapbox-draw-expandmapbox-gl-circlemapbox-gl-circle-forkedmapbox-gl-draw-scale-rotatemapbox-gl-draw-rotate-modeleaflet-truesizemdh-web-mapv2@whitewater-guide/clients@wn-test/core@varlab-ucf/nebula.gl@varlab-ucf/nebulagl-edit-modes@varlab-ucf/nebulagl-layers@turf/along@turf/angle@turf/turf@turf/midpoint@turf/point-on-line@turf/point-to-line-distance@turf/line-slice-along@turf/directional-mean@v-mapboxgl/plugin-arrow-line-layer@v-mapboxgl/plugin-cluster-layer@zalastax/nolb-_turaeroscoreagentmapsalt-route-labellercrosslinesdataset-to-tilesetfield-of-viewgeobuffergeohashes-alonggeohashes-betweengeo-data-integrationgeojson-minimum-bounding-rectanglegas.glgas3d.gl@shenyong/mapbox-gl-image@smart-factor/gem-ui-map-component
7.2.0

7 months ago

7.1.0

11 months ago

7.1.0-alpha.70

11 months ago

7.0.0

1 year ago

7.1.0-alpha.7

1 year ago

7.0.0-alpha.116

1 year ago

7.0.0-alpha.115

1 year ago

7.0.0-alpha.114

1 year ago

7.0.0-alpha.113

1 year ago

7.0.0-alpha.111

1 year ago

7.0.0-alpha.110

2 years ago

7.0.0-alpha.1

2 years ago

7.0.0-alpha.2

2 years ago

7.0.0-alpha.0

3 years ago

6.5.0

4 years ago

6.4.0

4 years ago

6.3.0

4 years ago

6.2.0

5 years ago

6.2.0-alpha.3

5 years ago

6.2.0-alpha.2

5 years ago

6.2.0-alpha.0

5 years ago

6.2.0-alpha.1

5 years ago

6.0.1

7 years ago

6.0.0

7 years ago

5.1.5

8 years ago

5.1.0

8 years ago

5.0.4

8 years ago

5.0.0

8 years ago

4.7.3

8 years ago

4.7.1

8 years ago

4.7.0

8 years ago

4.6.0

8 years ago

4.5.2

8 years ago

4.5.1

8 years ago

4.5.0

8 years ago

4.4.0

8 years ago

4.3.0

8 years ago

4.2.0

8 years ago

4.1.0

8 years ago

4.0.1

8 years ago

4.0.0

8 years ago

3.14.0

8 years ago

3.13.0

8 years ago

3.10.0

8 years ago

3.7.5

8 years ago

3.7.3

9 years ago

3.7.0

9 years ago

3.6.3

9 years ago

3.5.2

9 years ago

3.3.3

9 years ago

3.1.1

9 years ago

3.0.16

9 years ago

3.0.15

9 years ago