PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ LWGEOM_startpoint_linestring()

Datum LWGEOM_startpoint_linestring ( PG_FUNCTION_ARGS  )

Definition at line 826 of file lwgeom_ogc.c.

827 {
828  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
829  GSERIALIZED *ret;
830  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
831  LWGEOM *lwpoint = NULL;
832  POINT4D pt;
833 
834  if (lwgeom_startpoint(lwgeom, &pt) == LW_FAILURE)
835  {
836  PG_RETURN_NULL();
837  }
838 
839  lwpoint = (LWGEOM *)lwpoint_make(lwgeom->srid, lwgeom_has_z(lwgeom), lwgeom_has_m(lwgeom), &pt);
840  ret = geometry_serialize(lwpoint);
841 
842  lwgeom_free(lwgeom);
843  lwgeom_free(lwpoint);
844 
845  PG_FREE_IF_COPY(geom, 0);
846  PG_RETURN_POINTER(ret);
847 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:268
int lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
Definition: lwgeom.c:2221
#define LW_FAILURE
Definition: liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1218
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition: lwgeom.c:934
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition: lwgeom.c:941
LWPOINT * lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p)
Definition: lwpoint.c:206
int32_t srid
Definition: liblwgeom.h:460

References LW_FAILURE, lwgeom_free(), lwgeom_from_gserialized(), lwgeom_has_m(), lwgeom_has_z(), lwgeom_startpoint(), lwpoint_make(), and LWGEOM::srid.

Here is the call graph for this function: