PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ ST_Split()

Datum ST_Split ( PG_FUNCTION_ARGS  )

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

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

Referenced by ST_Snap().

3723 {
3724  GSERIALIZED *in, *blade_in, *out;
3725  LWGEOM *lwgeom_in, *lwblade_in, *lwgeom_out;
3726 
3727  in = PG_GETARG_GSERIALIZED_P(0);
3728  lwgeom_in = lwgeom_from_gserialized(in);
3729 
3730  blade_in = PG_GETARG_GSERIALIZED_P(1);
3731  lwblade_in = lwgeom_from_gserialized(blade_in);
3732 
3733  error_if_srid_mismatch(lwgeom_in->srid, lwblade_in->srid);
3734 
3735  lwgeom_out = lwgeom_split(lwgeom_in, lwblade_in);
3736  lwgeom_free(lwgeom_in);
3737  lwgeom_free(lwblade_in);
3738 
3739  if ( ! lwgeom_out )
3740  {
3741  PG_FREE_IF_COPY(in, 0); /* possibly referenced by lwgeom_out */
3742  PG_FREE_IF_COPY(blade_in, 1);
3743  PG_RETURN_NULL();
3744  }
3745 
3746  out = geometry_serialize(lwgeom_out);
3747  lwgeom_free(lwgeom_out);
3748  PG_FREE_IF_COPY(in, 0); /* possibly referenced by lwgeom_out */
3749  PG_FREE_IF_COPY(blade_in, 1);
3750 
3751  PG_RETURN_POINTER(out);
3752 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1050
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:341
int32_t srid
Definition: liblwgeom.h:383
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)
Here is the call graph for this function:
Here is the caller graph for this function: