PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ point_to_geometry()

Datum point_to_geometry ( PG_FUNCTION_ARGS  )

Definition at line 21 of file geometry_inout.c.

References geometry_serialize(), geometry_to_point(), lwpoint_as_lwgeom(), lwpoint_free(), lwpoint_make2d(), PG_FUNCTION_INFO_V1(), SRID_UNKNOWN, struct_point::x, and struct_point::y.

22 {
23  Point *point;
24  LWPOINT *lwpoint;
25  GSERIALIZED *geom;
26 
27  POSTGIS_DEBUG(2, "point_to_geometry called");
28 
29  if ( PG_ARGISNULL(0) )
30  PG_RETURN_NULL();
31 
32  point = PG_GETARG_POINT_P(0);
33 
34  if ( ! point )
35  PG_RETURN_NULL();
36 
37  lwpoint = lwpoint_make2d(SRID_UNKNOWN, point->x, point->y);
38  geom = geometry_serialize(lwpoint_as_lwgeom(lwpoint));
39  lwpoint_free(lwpoint);
40 
41  PG_RETURN_POINTER(geom);
42 }
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:132
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:182
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:172
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:254
Here is the call graph for this function: