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

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

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

1459 {
1460  GSERIALIZED *geom1;
1461  GSERIALIZED *geom2;
1463  LWGEOM *lwgeom1, *lwgeom2, *lwresult ;
1464 
1465  geom1 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
1466  geom2 = (GSERIALIZED *) PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
1467 
1468  lwgeom1 = lwgeom_from_gserialized(geom1) ;
1469  lwgeom2 = lwgeom_from_gserialized(geom2) ;
1470 
1471  lwresult = lwgeom_intersection(lwgeom1, lwgeom2) ;
1472  result = geometry_serialize(lwresult) ;
1473 
1474  lwgeom_free(lwgeom1) ;
1475  lwgeom_free(lwgeom2) ;
1476  lwgeom_free(lwresult) ;
1477 
1478  PG_FREE_IF_COPY(geom1, 0);
1479  PG_FREE_IF_COPY(geom2, 1);
1480 
1481  PG_RETURN_POINTER(result);
1482 }
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_intersection(const LWGEOM *geom1, const LWGEOM *geom2)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: