PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ flatgeobuf_agg_transfn()

void flatgeobuf_agg_transfn ( struct flatgeobuf_agg_ctx ctx)

Aggregation step.

Expands features array if needed by a factor of 2. Allocates a new feature, increment feature counter and encode properties into it.  

Definition at line 526 of file flatgeobuf.c.

527 {
528  LWGEOM *lwgeom = NULL;
529  bool isnull = false;
530  Datum datum;
531  GSERIALIZED *gs;
532 
533  if (ctx->ctx->features_count == 0)
534  inspect_table(ctx);
535 
536  datum = GetAttributeByNum(ctx->row, ctx->geom_index + 1, &isnull);
537  if (!isnull) {
538  gs = (GSERIALIZED *) PG_DETOAST_DATUM_COPY(datum);
539  lwgeom = lwgeom_from_gserialized(gs);
540  }
541  ctx->ctx->lwgeom = lwgeom;
542 
543  if (ctx->ctx->features_count == 0)
544  flatgeobuf_encode_header(ctx->ctx);
545 
546  encode_properties(ctx);
547  if (ctx->ctx->create_index)
548  ensure_items_len(ctx);
549  flatgeobuf_encode_feature(ctx->ctx);
550 }
static void inspect_table(struct flatgeobuf_agg_ctx *ctx)
Definition: flatgeobuf.c:68
static void encode_properties(flatgeobuf_agg_ctx *ctx)
Definition: flatgeobuf.c:152
static void ensure_items_len(struct flatgeobuf_agg_ctx *ctx)
Definition: flatgeobuf.c:138
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:268
HeapTupleHeader row
Definition: flatgeobuf.h:52
flatgeobuf_ctx * ctx
Definition: flatgeobuf.h:48
uint32_t geom_index
Definition: flatgeobuf.h:50

References flatgeobuf_agg_ctx::ctx, encode_properties(), ensure_items_len(), inspect_table(), and lwgeom_from_gserialized().

Referenced by pgis_asflatgeobuf_transfn().

Here is the call graph for this function:
Here is the caller graph for this function: