PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ ST_Difference()

Datum ST_Difference ( PG_FUNCTION_ARGS  )

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

1404 {
1405  GSERIALIZED *geom1;
1406  GSERIALIZED *geom2;
1408  LWGEOM *lwgeom1, *lwgeom2, *lwresult;
1409  double prec = -1;
1410 
1411  geom1 = PG_GETARG_GSERIALIZED_P(0);
1412  geom2 = PG_GETARG_GSERIALIZED_P(1);
1413  if (PG_NARGS() > 2 && ! PG_ARGISNULL(2))
1414  prec = PG_GETARG_FLOAT8(2);
1415 
1416  lwgeom1 = lwgeom_from_gserialized(geom1);
1417  lwgeom2 = lwgeom_from_gserialized(geom2);
1418 
1419  lwresult = lwgeom_difference_prec(lwgeom1, lwgeom2, prec);
1420  result = geometry_serialize(lwresult);
1421 
1422  lwgeom_free(lwgeom1);
1423  lwgeom_free(lwgeom2);
1424  lwgeom_free(lwresult);
1425 
1426  PG_FREE_IF_COPY(geom1, 0);
1427  PG_FREE_IF_COPY(geom2, 1);
1428 
1429  PG_RETURN_POINTER(result);
1430 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1138
LWGEOM * lwgeom_difference_prec(const LWGEOM *geom1, const LWGEOM *geom2, double gridSize)

References lwgeom_difference_prec(), lwgeom_free(), lwgeom_from_gserialized(), and result.

Here is the call graph for this function: