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

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

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

3573 {
3574 #if POSTGIS_GEOS_VERSION < 33
3575  lwerror("The GEOS version this PostGIS binary "
3576  "was compiled against (%d) doesn't support "
3577  "'ST_SharedPaths' function (3.3.0+ required)",
3579  PG_RETURN_NULL();
3580 #else /* POSTGIS_GEOS_VERSION >= 33 */
3581  GSERIALIZED *geom1, *geom2, *out;
3582  LWGEOM *g1, *g2, *lwgeom_out;
3583 
3584  geom1 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
3585  geom2 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
3586 
3587  g1 = lwgeom_from_gserialized(geom1);
3588  g2 = lwgeom_from_gserialized(geom2);
3589 
3590  lwgeom_out = lwgeom_sharedpaths(g1, g2);
3591  lwgeom_free(g1);
3592  lwgeom_free(g2);
3593 
3594  if ( ! lwgeom_out )
3595  {
3596  PG_FREE_IF_COPY(geom1, 0);
3597  PG_FREE_IF_COPY(geom2, 1);
3598  PG_RETURN_NULL();
3599  }
3600 
3601  out = geometry_serialize(lwgeom_out);
3602  lwgeom_free(lwgeom_out);
3603 
3604  PG_FREE_IF_COPY(geom1, 0);
3605  PG_FREE_IF_COPY(geom2, 1);
3606  PG_RETURN_POINTER(out);
3607 
3608 #endif /* POSTGIS_GEOS_VERSION >= 33 */
3609 
3610 }
#define POSTGIS_GEOS_VERSION
Definition: sqldefines.h:10
LWGEOM * lwgeom_sharedpaths(const LWGEOM *geom1, const LWGEOM *geom2)
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
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: