PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ LWGEOM_x_point()

Datum LWGEOM_x_point ( PG_FUNCTION_ARGS  )

Definition at line 745 of file lwgeom_ogc.c.

746 {
747  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
748  POINT4D pt;
749 
750  if (gserialized_get_type(geom) != POINTTYPE)
751  lwpgerror("Argument to ST_X() must have type POINT");
752 
753  if (gserialized_peek_first_point(geom, &pt) == LW_FAILURE)
754  {
755  PG_RETURN_NULL();
756  }
757  PG_RETURN_FLOAT8(pt.x);
758 }
int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point)
Pull the first point values of a GSERIALIZED.
Definition: gserialized.c:286
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:118
#define LW_FAILURE
Definition: liblwgeom.h:96
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
Definition: liblwgeom.h:102
double x
Definition: liblwgeom.h:414

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

Here is the call graph for this function: