332 #if POSTGIS_GEOS_VERSION < 35 334 elog(ERROR,
"The GEOS version this PostGIS binary " 335 "was compiled against (%d) doesn't support " 336 "'%s' function (3.5.0+ required)",
349 FuncCallContext *funcctx;
350 collection_fctx *fctx;
351 MemoryContext oldcontext;
354 if (SRF_IS_FIRSTCALL())
359 int maxvertices = 256;
362 funcctx = SRF_FIRSTCALL_INIT();
367 oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
372 gser = PG_GETARG_GSERIALIZED_P(0);
378 if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
379 maxvertices = PG_GETARG_INT32(1);
387 SRF_RETURN_DONE(funcctx);
390 fctx = (collection_fctx *) palloc(
sizeof(collection_fctx));
394 fctx->numgeoms = col->
ngeoms;
398 funcctx->user_fctx = fctx;
399 MemoryContextSwitchTo(oldcontext);
403 funcctx = SRF_PERCALL_SETUP();
404 fctx = funcctx->user_fctx;
406 if (fctx->nextgeom < fctx->numgeoms)
410 SRF_RETURN_NEXT(funcctx, PointerGetDatum(gpart));
415 SRF_RETURN_DONE(funcctx);
#define POSTGIS_GEOS_VERSION
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
LWCOLLECTION * lwgeom_subdivide(const LWGEOM *geom, int maxvertices)
GSERIALIZED * geometry_serialize(LWGEOM *lwgeom)