1055{
1060 double azimuth;
1062 uint32_t type1, type2;
1063
1064
1065 g1 = PG_GETARG_GSERIALIZED_P(0);
1066 g2 = PG_GETARG_GSERIALIZED_P(1);
1067
1068
1072 {
1073 elog(ERROR, "ST_Azimuth(geography, geography) is only valid for point inputs");
1074 PG_RETURN_NULL();
1075 }
1076
1079
1080
1082 {
1085 elog(ERROR, "ST_Azimuth(geography, geography) cannot work with empty points");
1086 PG_RETURN_NULL();
1087 }
1088
1089
1091
1092
1094
1095
1098
1099 PG_FREE_IF_COPY(g1, 0);
1100 PG_FREE_IF_COPY(g2, 1);
1101
1102
1103 if( isnan(azimuth) )
1104 {
1105 PG_RETURN_NULL();
1106 }
1107
1108 PG_RETURN_FLOAT8(azimuth);
1109}
int32_t gserialized_get_srid(const GSERIALIZED *g)
Extract the SRID from the serialized form (it is packed into three bytes so this is a handy function)...
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
void lwgeom_free(LWGEOM *geom)
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
double lwgeom_azumith_spheroid(const LWPOINT *r, const LWPOINT *s, const SPHEROID *spheroid)
Calculate the bearing between two points on a spheroid.
static LWPOINT * lwgeom_as_lwpoint(const LWGEOM *lwgeom)
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)