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

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

References error_if_srid_mismatch(), geometry_serialize(), lwgeom_free(), lwgeom_from_gserialized(), lwgeom_split(), and LWGEOM::srid.

3524 {
3525  GSERIALIZED *in, *blade_in, *out;
3526  LWGEOM *lwgeom_in, *lwblade_in, *lwgeom_out;
3527 
3528  in = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(0));
3529  lwgeom_in = lwgeom_from_gserialized(in);
3530 
3531  blade_in = (GSERIALIZED *)PG_DETOAST_DATUM(PG_GETARG_DATUM(1));
3532  lwblade_in = lwgeom_from_gserialized(blade_in);
3533 
3534  error_if_srid_mismatch(lwgeom_in->srid, lwblade_in->srid);
3535 
3536  lwgeom_out = lwgeom_split(lwgeom_in, lwblade_in);
3537  lwgeom_free(lwgeom_in);
3538  lwgeom_free(lwblade_in);
3539 
3540  if ( ! lwgeom_out )
3541  {
3542  PG_FREE_IF_COPY(in, 0); /* possibly referenced by lwgeom_out */
3543  PG_FREE_IF_COPY(blade_in, 1);
3544  PG_RETURN_NULL();
3545  }
3546 
3547  out = geometry_serialize(lwgeom_out);
3548  lwgeom_free(lwgeom_out);
3549  PG_FREE_IF_COPY(in, 0); /* possibly referenced by lwgeom_out */
3550  PG_FREE_IF_COPY(blade_in, 1);
3551 
3552  PG_RETURN_POINTER(out);
3553 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:317
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1006
int32_t srid
Definition: liblwgeom.h:355
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)

Here is the call graph for this function: