PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ point_to_geometry()

Datum point_to_geometry ( PG_FUNCTION_ARGS  )

Definition at line 45 of file geometry_inout.c.

46 {
47  Point *point;
48  LWPOINT *lwpoint;
49  GSERIALIZED *geom;
50 
51  POSTGIS_DEBUG(2, "point_to_geometry called");
52 
53  if ( PG_ARGISNULL(0) )
54  PG_RETURN_NULL();
55 
56  point = PG_GETARG_POINT_P(0);
57 
58  if ( ! point )
59  PG_RETURN_NULL();
60 
61  lwpoint = lwpoint_make2d(SRID_UNKNOWN, point->x, point->y);
62  geom = geometry_serialize(lwpoint_as_lwgeom(lwpoint));
63  lwpoint_free(lwpoint);
64 
65  PG_RETURN_POINTER(geom);
66 }
LWPOINT * lwpoint_make2d(int srid, double x, double y)
Definition: lwpoint.c:163
void lwpoint_free(LWPOINT *pt)
Definition: lwpoint.c:213
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
Definition: lwgeom.c:335
#define SRID_UNKNOWN
Unknown SRID value.
Definition: liblwgeom.h:188
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

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

Here is the call graph for this function: