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

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

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

3823 {
3824 #if POSTGIS_GEOS_VERSION < 33
3825  lwpgerror("The GEOS version this PostGIS binary "
3826  "was compiled against (%d) doesn't support "
3827  "'ST_Node' function (3.3.0+ required)",
3829  PG_RETURN_NULL();
3830 #else /* POSTGIS_GEOS_VERSION >= 33 */
3831  GSERIALIZED *geom1, *out;
3832  LWGEOM *g1, *lwgeom_out;
3833 
3834  geom1 = PG_GETARG_GSERIALIZED_P(0);
3835 
3836  g1 = lwgeom_from_gserialized(geom1);
3837 
3838  lwgeom_out = lwgeom_node(g1);
3839  lwgeom_free(g1);
3840 
3841  if ( ! lwgeom_out )
3842  {
3843  PG_FREE_IF_COPY(geom1, 0);
3844  PG_RETURN_NULL();
3845  }
3846 
3847  out = geometry_serialize(lwgeom_out);
3848  lwgeom_free(lwgeom_out);
3849 
3850  PG_FREE_IF_COPY(geom1, 0);
3851  PG_RETURN_POINTER(out);
3852 
3853 #endif /* POSTGIS_GEOS_VERSION >= 33 */
3854 
3855 }
#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:1050
LWGEOM * lwgeom_node(const LWGEOM *lwgeom_in)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: