PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 1094 of file mvt.c.

1095 {
1096  /* Fill out the tile slot, if it's not already filled. */
1097  /* We should only have a filled slot when all the work of building */
1098  /* out the data is complete, so after a serialize/deserialize cycle */
1099  /* or after a context combine */
1100  size_t len;
1101  bytea *ba;
1102 
1103  if (!ctx->tile)
1104  {
1105  ctx->tile = mvt_ctx_to_tile(ctx);
1106  }
1107 
1108  /* Zero features => empty bytea output */
1109  if (ctx && ctx->layer && ctx->layer->n_features == 0)
1110  {
1111  bytea* ba_empty = palloc(VARHDRSZ);
1112  SET_VARSIZE(ba_empty, VARHDRSZ);
1113  return ba_empty;
1114  }
1115 
1116  /* Serialize the Tile */
1117  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
1118  ba = palloc(len);
1119  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
1120  SET_VARSIZE(ba, len);
1121  return ba;
1122 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:1079
VectorTile__Tile__Layer * layer
Definition: mvt.h:76
VectorTile__Tile * tile
Definition: mvt.h:80

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: