PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ LWGEOM_z_point()

Datum LWGEOM_z_point ( PG_FUNCTION_ARGS  )

Definition at line 642 of file lwgeom_ogc.c.

643 {
644  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
645  POINT4D pt;
646 
647  if (gserialized_get_type(geom) != POINTTYPE)
648  lwpgerror("Argument to ST_Z() must have type POINT");
649 
650  if (!gserialized_has_z(geom) || (gserialized_peek_first_point(geom, &pt) == LW_FAILURE))
651  {
652  PG_RETURN_NULL();
653  }
654  PG_RETURN_FLOAT8(pt.z);
655 }
int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point)
Pull the first point values of a GSERIALIZED.
Definition: gserialized.c:257
int gserialized_has_z(const GSERIALIZED *g)
Check if a GSERIALIZED has a Z ordinate.
Definition: gserialized.c:174
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
Definition: gserialized.c:89
#define LW_FAILURE
Definition: liblwgeom.h:110
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:116
double z
Definition: liblwgeom.h:428

References gserialized_get_type(), gserialized_has_z(), gserialized_peek_first_point(), LW_FAILURE, POINTTYPE, and POINT4D::z.

Here is the call graph for this function: