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

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

References geometry_serialize(), lwgeom_difference(), lwgeom_free(), lwgeom_from_gserialized(), and result.

1491 {
1492  GSERIALIZED *geom1;
1493  GSERIALIZED *geom2;
1495  LWGEOM *lwgeom1, *lwgeom2, *lwresult ;
1496 
1497  geom1 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1498  geom2 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
1499 
1500  lwgeom1 = lwgeom_from_gserialized(geom1) ;
1501  lwgeom2 = lwgeom_from_gserialized(geom2) ;
1502 
1503  lwresult = lwgeom_difference(lwgeom1, lwgeom2) ;
1504  result = geometry_serialize(lwresult) ;
1505 
1506  lwgeom_free(lwgeom1) ;
1507  lwgeom_free(lwgeom2) ;
1508  lwgeom_free(lwresult) ;
1509 
1510  PG_FREE_IF_COPY(geom1, 0);
1511  PG_FREE_IF_COPY(geom2, 1);
1512 
1513  PG_RETURN_POINTER(result);
1514 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
char ** result
Definition: liblwgeom.h:218
LWGEOM * lwgeom_difference(const LWGEOM *geom1, const LWGEOM *geom2)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: