Calculate a projected point given a source point, a distance and a bearing.
Calculate the location of a point on a spheroid, give a start point, bearing and distance.
- Parameters
-
r | - location of first point. |
spheroid | - spheroid definition. |
distance | - distance, in units of the spheroid def'n. |
azimuth | - azimuth in radians. |
- Returns
- s - location of projected point.
Definition at line 2095 of file lwgeodetic.c.
References distance(), geographic_point_init(), GEOGRAPHIC_POINT::lat, latitude_radians_normalize(), GEOGRAPHIC_POINT::lon, longitude_radians_normalize(), LW_FAILURE, LW_TRUE, LWDEBUGF, lwerror(), lwgeom_set_geodetic(), lwpoint_as_lwgeom(), lwpoint_construct(), lwpoint_get_x(), lwpoint_get_y(), POINT4D::m, ptarray_construct(), ptarray_set_point4d(), rad2deg, SPHEROID::radius, spheroid_project(), LWPOINT::srid, pixval::x, POINT4D::x, pixval::y, POINT4D::y, and POINT4D::z.
Referenced by geography_project().
2110 azimuth -= 2.0 * M_PI * floor(azimuth / (2.0 * M_PI));
2115 lwerror(
"Distance must not be greater than %g", M_PI * spheroid->
radius);
2127 LWDEBUGF(3,
"Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth,
distance);
2128 lwerror(
"Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth,
distance);
2136 pt_dest.
z = pt_dest.
m = 0.0;
void ptarray_set_point4d(POINTARRAY *pa, int n, const POINT4D *p4d)
POINTARRAY * ptarray_construct(char hasz, char hasm, uint32_t npoints)
Construct an empty pointarray, allocating storage and setting the npoints, but not filling in any inf...
double longitude_radians_normalize(double lon)
Convert a longitude to the range of -PI,PI.
Point in spherical coordinates on the world.
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...
double lwpoint_get_x(const LWPOINT *point)
#define LW_TRUE
Return types for functions with status returns.
Datum distance(PG_FUNCTION_ARGS)
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
double latitude_radians_normalize(double lat)
Convert a latitude to the range of -PI/2,PI/2.
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
double lwpoint_get_y(const LWPOINT *point)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.