PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ ST_Difference()

Datum ST_Difference ( PG_FUNCTION_ARGS  )

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

1494 {
1495  GSERIALIZED *geom1;
1496  GSERIALIZED *geom2;
1498  LWGEOM *lwgeom1, *lwgeom2, *lwresult;
1499  double prec = -1;
1500 
1501  geom1 = PG_GETARG_GSERIALIZED_P(0);
1502  geom2 = PG_GETARG_GSERIALIZED_P(1);
1503  if (PG_NARGS() > 2 && ! PG_ARGISNULL(2))
1504  prec = PG_GETARG_FLOAT8(2);
1505 
1506  lwgeom1 = lwgeom_from_gserialized(geom1);
1507  lwgeom2 = lwgeom_from_gserialized(geom2);
1508 
1509  lwresult = lwgeom_difference_prec(lwgeom1, lwgeom2, prec);
1510  result = geometry_serialize(lwresult);
1511 
1512  lwgeom_free(lwgeom1);
1513  lwgeom_free(lwgeom2);
1514  lwgeom_free(lwresult);
1515 
1516  PG_FREE_IF_COPY(geom1, 0);
1517  PG_FREE_IF_COPY(geom2, 1);
1518 
1519  PG_RETURN_POINTER(result);
1520 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
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:1155
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: