PostGIS  3.4.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 527 of file flatgeobuf.c.

528 {
529  LWGEOM *lwgeom = NULL;
530  bool isnull = false;
531  Datum datum;
532  GSERIALIZED *gs;
533 
534  if (ctx->ctx->features_count == 0)
535  inspect_table(ctx);
536 
537  datum = GetAttributeByNum(ctx->row, ctx->geom_index + 1, &isnull);
538  if (!isnull) {
539  gs = (GSERIALIZED *) PG_DETOAST_DATUM_COPY(datum);
540  lwgeom = lwgeom_from_gserialized(gs);
541  }
542  ctx->ctx->lwgeom = lwgeom;
543 
544  if (ctx->ctx->features_count == 0)
545  flatgeobuf_encode_header(ctx->ctx);
546 
547  encode_properties(ctx);
548  if (ctx->ctx->create_index)
549  ensure_items_len(ctx);
550  flatgeobuf_encode_feature(ctx->ctx);
551 }
static void inspect_table(struct flatgeobuf_agg_ctx *ctx)
Definition: flatgeobuf.c:69
static void encode_properties(flatgeobuf_agg_ctx *ctx)
Definition: flatgeobuf.c:153
static void ensure_items_len(struct flatgeobuf_agg_ctx *ctx)
Definition: flatgeobuf.c:139
LWGEOM * lwgeom_from_gserialized(const GSERIALIZED *g)
Allocate a new LWGEOM from a GSERIALIZED.
Definition: gserialized.c:239
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: