PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ LWGEOM_startpoint_linestring()

Datum LWGEOM_startpoint_linestring ( PG_FUNCTION_ARGS  )

Definition at line 820 of file lwgeom_ogc.c.

821{
822 GSERIALIZED *geom = PG_GETARG_GSERIALIZED_P(0);
823 GSERIALIZED *ret;
824 LWGEOM *lwgeom = lwgeom_from_gserialized(geom);
825 LWGEOM *lwpoint = NULL;
826 POINT4D pt;
827
828 if (lwgeom_startpoint(lwgeom, &pt) == LW_FAILURE)
829 {
830 PG_RETURN_NULL();
831 }
832
833 lwpoint = (LWGEOM *)lwpoint_make(lwgeom->srid, lwgeom_has_z(lwgeom), lwgeom_has_m(lwgeom), &pt);
834 ret = geometry_serialize(lwpoint);
835
836 lwgeom_free(lwgeom);
837 lwgeom_free(lwpoint);
838
839 PG_FREE_IF_COPY(geom, 0);
840 PG_RETURN_POINTER(ret);
841}
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
int lwgeom_startpoint(const LWGEOM *lwgeom, POINT4D *pt)
Definition lwgeom.c:2249
#define LW_FAILURE
Definition liblwgeom.h:96
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1246
int lwgeom_has_z(const LWGEOM *geom)
Return LW_TRUE if geometry has Z ordinates.
Definition lwgeom.c:962
LWPOINT * lwpoint_make(int32_t srid, int hasz, int hasm, const POINT4D *p)
Definition lwpoint.c:206
int lwgeom_has_m(const LWGEOM *geom)
Return LW_TRUE if geometry has M ordinates.
Definition lwgeom.c:969
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: