PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum geos_difference ( PG_FUNCTION_ARGS  )

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

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

1208 {
1209  GSERIALIZED *geom1;
1210  GSERIALIZED *geom2;
1211  GSERIALIZED *result;
1212  LWGEOM *lwgeom1, *lwgeom2, *lwresult ;
1213 
1214  geom1 = PG_GETARG_GSERIALIZED_P(0);
1215  geom2 = PG_GETARG_GSERIALIZED_P(1);
1216 
1217  lwgeom1 = lwgeom_from_gserialized(geom1) ;
1218  lwgeom2 = lwgeom_from_gserialized(geom2) ;
1219 
1220  lwresult = lwgeom_difference(lwgeom1, lwgeom2) ;
1221  result = geometry_serialize(lwresult) ;
1222 
1223  lwgeom_free(lwgeom1) ;
1224  lwgeom_free(lwgeom2) ;
1225  lwgeom_free(lwresult) ;
1226 
1227  PG_FREE_IF_COPY(geom1, 0);
1228  PG_FREE_IF_COPY(geom2, 1);
1229 
1230  PG_RETURN_POINTER(result);
1231 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1137
LWGEOM * lwgeom_difference(const LWGEOM *geom1, const LWGEOM *geom2)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)

Here is the call graph for this function: