Calculate the location of a point on a spheroid, give a start point, bearing and distance.
Calculate the location of a point on a spheroid, give a start point, bearing and distance.
2100{
2106
2107
2110 azimuth += M_PI;
2111 }
2112
2113
2114 azimuth -= 2.0 * M_PI * floor(azimuth / (2.0 * M_PI));
2115
2116
2118 {
2119 lwerror(
"Distance must not be greater than %g", M_PI * spheroid->
radius);
2120 return NULL;
2121 }
2122
2123
2127
2128
2130 {
2131 LWDEBUGF(3,
"Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth,
distance);
2132 lwerror(
"Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth,
distance);
2133 return NULL;
2134 }
2135
2136
2140 pt_dest.
z = pt_dest.
m = 0.0;
2144 return lwp;
2145}
void lwgeom_set_geodetic(LWGEOM *geom, int value)
Set the FLAGS geodetic bit on geometry an all sub-geometries and pointlists.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
LWPOINT * lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point)
double lwpoint_get_x(const LWPOINT *point)
#define LW_TRUE
Return types for functions with status returns.
void ptarray_set_point4d(POINTARRAY *pa, uint32_t n, const POINT4D *p4d)
double lwpoint_get_y(const LWPOINT *point)
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.
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.
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.
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static double distance(double x1, double y1, double x2, double y2)
Point in spherical coordinates on the world.