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.
1968{
1973 int has_z, has_m;
1974
1975
1978 azimuth += M_PI;
1979 }
1980
1981
1982 azimuth -= 2.0 * M_PI * floor(azimuth / (2.0 * M_PI));
1983
1984
1986 {
1987 lwerror(
"Distance must not be greater than %g", M_PI * spheroid->
radius);
1988 return NULL;
1989 }
1990
1991
1997
1998
2000 {
2001 LWDEBUGF(3,
"Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth,
distance);
2002 lwerror(
"Unable to project from (%g %g) with azimuth %g and distance %g", x, y, azimuth,
distance);
2003 return NULL;
2004 }
2005
2006
2013 return lwp;
2014}
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)
double lwpoint_get_m(const LWPOINT *point)
double lwpoint_get_x(const LWPOINT *point)
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
LWPOINT * lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p)
double lwpoint_get_z(const LWPOINT *point)
#define LW_TRUE
Return types for functions with status returns.
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
double lwpoint_get_y(const LWPOINT *point)
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 void lwerror(const char *fmt,...) __attribute__((format(printf
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.