PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ LWGEOM_startpoint_linestring()

Datum LWGEOM_startpoint_linestring ( PG_FUNCTION_ARGS  )

Definition at line 687 of file lwgeom_ogc.c.

688 {
689  GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
690  GSERIALIZED *ret;
691  LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
692  LWGEOM *lwpoint = NULL;
693  POINT4D pt;
694 
695  if (lwgeom_startpoint(lwgeom, &pt) == LW_FAILURE)
696  {
697  PG_RETURN_NULL();
698  }
699 
700  lwpoint = (LWGEOM *)lwpoint_make(lwgeom->srid, lwgeom_has_z(lwgeom), lwgeom_has_m(lwgeom), &pt);
701  ret = geometry_serialize(lwpoint);
702 
703  lwgeom_free(lwgeom);
704  lwgeom_free(lwpoint);
705 
706  PG_FREE_IF_COPY(geom, 0);
707  PG_RETURN_POINTER(ret);
708 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
int lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
Definition: lwgeom.c:2135
#define LW_FAILURE
Definition: liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
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: