# Using azimuths and bearings in GeographicLib? [closed]

I am currently using the JavaScript port of the geodesic routines from GeographicLib:

https://geographiclib.sourceforge.io/html/js/

https://github.com/yurijmikhalevich/node-geographiclib

I am computing the inverse problem where given lat1,lon1,lat2,lon2 the various azimuth's and the distance is computed:

``````var geod = GeographicLib.Geodesic.WGS84, r;
r = geod.Inverse(lat_aid, lon_aid, lat_loc, lon_loc);
``````

The description of the function is given here: https://geographiclib.sourceforge.io/html/classGeographicLib_1_1Geodesic.html

My use case is one where one set of my lat_loc,lon_loc is a given location, and the other set of lat_aid,lon_aid is a navigation aid used to get to the location. I am looking to calculate the distance and bearing from the aid to the location.

Unfortunately I am not a GIS expert or very versed in geography in general and I am have a few questions:

1. I am having trouble figuring out which azimuth I require (azi2 vs azi1)

2. Are the calculated azimuths based on grid or true north? Is there any real difference in this model since it estimates the Earth's shape.

3. The values I get seem to range from 0 to 180 and 0 to -180, am I correct in assuming that a positive azimuth value is clockwise from north, and a negative value is counterclockwise from north? ie: azi -70 would be a bearing of N 70 W and an azimuth of 70 would be N 70 E

1. Regarding `azi1` vs `azi2`, `azi1` is the direction measured at point 1 (your navigation aid) to point 2. `azi2` is the direction measured at point 2 (your location) away from point 1. (If you want the direction to point 1, add ±180° to `azi2`.) Which azimuth you require will depend on what problem you're trying to solve.