PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ spheroid_project()

int spheroid_project ( const GEOGRAPHIC_POINT r,
const SPHEROID spheroid,
double  distance,
double  azimuth,
GEOGRAPHIC_POINT g 
)

Given a location, an azimuth and a distance, computes the location of the projected point.

Using the direct geodesic problem from GeographicLib (Karney 2013).

Parameters
r- location of first point
distance- distance in meters
azimuth- azimuth in radians
Returns
g - location of projected point

Definition at line 128 of file lwspheroid.c.

129 {
130  struct geod_geodesic gd;
131  geod_init(&gd, spheroid->a, spheroid->f);
132  double lat1 = r->lat * 180.0 / M_PI;
133  double lon1 = r->lon * 180.0 / M_PI;
134  double lat2, lon2; /* return projected position */
135  geod_direct(&gd, lat1, lon1, azimuth * 180.0 / M_PI, distance, &lat2, &lon2, 0);
136  g->lat = lat2 * M_PI / 180.0;
137  g->lon = lon2 * M_PI / 180.0;
138  return LW_SUCCESS;
139 }
char * r
Definition: cu_in_wkt.c:24
#define LW_SUCCESS
Definition: liblwgeom.h:111
static double distance(double x1, double y1, double x2, double y2)
Definition: lwtree.c:1032
double a
Definition: liblwgeom.h:361
double f
Definition: liblwgeom.h:363

References SPHEROID::a, distance(), SPHEROID::f, GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, LW_SUCCESS, and r.

Referenced by lwgeom_project_spheroid().

Here is the call graph for this function:
Here is the caller graph for this function: