PostGIS  2.1.10dev-r@@SVN_REVISION@@
Datum ST_Node ( PG_FUNCTION_ARGS  )

Definition at line 3623 of file postgis/lwgeom_geos.c.

References geometry_serialize(), lwerror(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_node(), and POSTGIS_GEOS_VERSION.

3624 {
3625 #if POSTGIS_GEOS_VERSION < 33
3626  lwerror("The GEOS version this PostGIS binary "
3627  "was compiled against (%d) doesn't support "
3628  "'ST_Node' function (3.3.0+ required)",
3630  PG_RETURN_NULL();
3631 #else /* POSTGIS_GEOS_VERSION >= 33 */
3632  GSERIALIZED *geom1, *out;
3633  LWGEOM *g1, *lwgeom_out;
3634 
3635  geom1 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
3636 
3637  g1 = lwgeom_from_gserialized(geom1);
3638 
3639  lwgeom_out = lwgeom_node(g1);
3640  lwgeom_free(g1);
3641 
3642  if ( ! lwgeom_out )
3643  {
3644  PG_FREE_IF_COPY(geom1, 0);
3645  PG_RETURN_NULL();
3646  }
3647 
3648  out = geometry_serialize(lwgeom_out);
3649  lwgeom_free(lwgeom_out);
3650 
3651  PG_FREE_IF_COPY(geom1, 0);
3652  PG_RETURN_POINTER(out);
3653 
3654 #endif /* POSTGIS_GEOS_VERSION >= 33 */
3655 
3656 }
#define POSTGIS_GEOS_VERSION
Definition: sqldefines.h:10
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67
LWGEOM * lwgeom_node(const LWGEOM *lwgeom_in)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: