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

◆ geometry_to_point()

Datum geometry_to_point ( PG_FUNCTION_ARGS  )

Definition at line 72 of file geometry_inout.c.

73{
74 Point *point;
75 POINT4D pt;
76 GSERIALIZED *geom;
77
78 if (PG_ARGISNULL(0))
79 PG_RETURN_NULL();
80 geom = PG_GETARG_GSERIALIZED_P(0);
81
83 elog(ERROR, "geometry_to_point only accepts Points");
84
86 PG_RETURN_NULL();
87
88 point = (Point *)palloc(sizeof(Point));
89 point->x = pt.x;
90 point->y = pt.y;
91
92 PG_RETURN_POINT_P(point);
93}
int gserialized_peek_first_point(const GSERIALIZED *g, POINT4D *out_point)
Pull the first point values of a GSERIALIZED.
uint32_t gserialized_get_type(const GSERIALIZED *g)
Extract the geometry type from the serialized form (it hides in the anonymous data area,...
#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
double y
Definition liblwgeom.h:414

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

Here is the call graph for this function: