PostGIS  3.2.2dev-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 519 of file flatgeobuf.c.

520 {
521  LWGEOM *lwgeom = NULL;
522  bool isnull = false;
523  Datum datum;
524  GSERIALIZED *gs;
525 
526  if (ctx->ctx->features_count == 0)
527  inspect_table(ctx);
528 
529  datum = GetAttributeByNum(ctx->row, ctx->geom_index + 1, &isnull);
530  if (!isnull) {
531  gs = (GSERIALIZED *) PG_DETOAST_DATUM_COPY(datum);
532  lwgeom = lwgeom_from_gserialized(gs);
533  }
534  ctx->ctx->lwgeom = lwgeom;
535 
536  if (ctx->ctx->features_count == 0)
537  flatgeobuf_encode_header(ctx->ctx);
538 
539  encode_properties(ctx);
540  if (ctx->ctx->create_index)
541  ensure_items_len(ctx);
542  flatgeobuf_encode_feature(ctx->ctx);
543 }
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: