PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ ST_Split()

Datum ST_Split ( PG_FUNCTION_ARGS  )

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

3177 {
3178  GSERIALIZED *in, *blade_in, *out;
3179  LWGEOM *lwgeom_in, *lwblade_in, *lwgeom_out;
3180 
3181  in = PG_GETARG_GSERIALIZED_P(0);
3182  lwgeom_in = lwgeom_from_gserialized(in);
3183 
3184  blade_in = PG_GETARG_GSERIALIZED_P(1);
3185  lwblade_in = lwgeom_from_gserialized(blade_in);
3186 
3187  error_if_srid_mismatch(lwgeom_in->srid, lwblade_in->srid);
3188 
3189  lwgeom_out = lwgeom_split(lwgeom_in, lwblade_in);
3190  lwgeom_free(lwgeom_in);
3191  lwgeom_free(lwblade_in);
3192 
3193  if ( ! lwgeom_out )
3194  {
3195  PG_FREE_IF_COPY(in, 0); /* possibly referenced by lwgeom_out */
3196  PG_FREE_IF_COPY(blade_in, 1);
3197  PG_RETURN_NULL();
3198  }
3199 
3200  out = geometry_serialize(lwgeom_out);
3201  lwgeom_free(lwgeom_out);
3202  PG_FREE_IF_COPY(in, 0); /* possibly referenced by lwgeom_out */
3203  PG_FREE_IF_COPY(blade_in, 1);
3204 
3205  PG_RETURN_POINTER(out);
3206 }
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1144
LWGEOM * lwgeom_split(const LWGEOM *lwgeom_in, const LWGEOM *blade_in)
void error_if_srid_mismatch(int srid1, int srid2)
Definition: lwutil.c:338
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)
int32_t srid
Definition: liblwgeom.h:402

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

Here is the call graph for this function: