941 double azimuth = 0.0;
947 if ( PG_NARGS() < 2 || PG_ARGISNULL(0) || PG_ARGISNULL(1) )
951 g = PG_GETARG_GSERIALIZED_P(0);
957 elog(ERROR,
"ST_Project(geography) is only valid for point inputs");
961 distance = PG_GETARG_FLOAT8(1);
968 elog(ERROR,
"ST_Project(geography) cannot project from an empty start point");
972 if ( PG_NARGS() > 2 && ! PG_ARGISNULL(2) )
973 azimuth = PG_GETARG_FLOAT8(2);
981 PG_RETURN_POINTER(g);
988 if ( lwp_projected == NULL )
990 elog(ERROR,
"lwgeom_project_spheroid returned null");
999 PG_FREE_IF_COPY(g, 0);
1000 PG_RETURN_POINTER(g_out);
uint32_t gserialized_get_type(const GSERIALIZED *s)
Extract the geometry type from the serialized form (it hides in the anonymous data area...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwpoint_free(LWPOINT *pt)
void lwgeom_free(LWGEOM *geom)
LWPOINT * lwgeom_project_spheroid(const LWPOINT *r, const SPHEROID *spheroid, double distance, double azimuth)
Calculate the location of a point on a spheroid, give a start point, bearing and distance.
LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
Datum distance(PG_FUNCTION_ARGS)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...
int32_t gserialized_get_srid(const GSERIALIZED *s)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...