PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ spheroid_direction()

double spheroid_direction ( const GEOGRAPHIC_POINT a,
const GEOGRAPHIC_POINT b,
const SPHEROID spheroid 
)

Computes the forward azimuth of the geodesic joining two points on the spheroid, using the inverse geodesic problem (Karney 2013).

Parameters
r- location of first point
s- location of second point
Returns
azimuth of line joining r to s (but not reverse)

Definition at line 105 of file lwspheroid.c.

106 {
107  struct geod_geodesic gd;
108  geod_init(&gd, spheroid->a, spheroid->f);
109  double lat1 = a->lat * 180.0 / M_PI;
110  double lon1 = a->lon * 180.0 / M_PI;
111  double lat2 = b->lat * 180.0 / M_PI;
112  double lon2 = b->lon * 180.0 / M_PI;
113  double azi1; /* return azimuth */
114  geod_inverse(&gd, lat1, lon1, lat2, lon2, 0, &azi1, 0);
115  return azi1 * M_PI / 180.0;
116 }
double a
Definition: liblwgeom.h:361
double f
Definition: liblwgeom.h:363

References SPHEROID::a, SPHEROID::f, GEOGRAPHIC_POINT::lat, and GEOGRAPHIC_POINT::lon.

Referenced by lwgeom_azumith_spheroid().

Here is the caller graph for this function: