PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 1070 of file mvt.c.

1071 {
1072  /* Fill out the tile slot, if it's not already filled. */
1073  /* We should only have a filled slot when all the work of building */
1074  /* out the data is complete, so after a serialize/deserialize cycle */
1075  /* or after a context combine */
1076  size_t len;
1077  bytea *ba;
1078 
1079  if (!ctx->tile)
1080  {
1081  ctx->tile = mvt_ctx_to_tile(ctx);
1082  }
1083 
1084  /* Zero features => empty bytea output */
1085  if (ctx && ctx->layer && ctx->layer->n_features == 0)
1086  {
1087  bytea *ba = palloc(VARHDRSZ);
1088  SET_VARSIZE(ba, VARHDRSZ);
1089  return ba;
1090  }
1091 
1092  /* Serialize the Tile */
1093  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
1094  ba = palloc(len);
1095  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
1096  SET_VARSIZE(ba, len);
1097  return ba;
1098 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:1055
VectorTile__Tile__Layer * layer
Definition: mvt.h:76
VectorTile__Tile * tile
Definition: mvt.h:77

References mvt_agg_context::layer, mvt_ctx_to_tile(), and mvt_agg_context::tile.

Referenced by mvt_agg_finalfn(), and mvt_ctx_serialize().

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