PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ LWGEOM_m_point()

Datum LWGEOM_m_point ( PG_FUNCTION_ARGS  )

Definition at line 661 of file lwgeom_ogc.c.

662 {
663  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
664  POINT4D pt;
665 
666  if (gserialized_get_type(geom) != POINTTYPE)
667  lwpgerror("Argument to ST_M() must have type POINT");
668 
669  if (!gserialized_has_m(geom) || (gserialized_peek_first_point(geom, &pt) == LW_FAILURE))
670  {
671  PG_RETURN_NULL();
672  }
673  PG_RETURN_FLOAT8(pt.m);
674 }
int gserialized_has_m(const GSERIALIZED *g)
Check if a GSERIALIZED has an M ordinate.
Definition: gserialized.c:185
int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point)
Pull the first point values of a GSERIALIZED.
Definition: gserialized.c:257
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 m
Definition: liblwgeom.h:400

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

Here is the call graph for this function: