PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 1342 of file mvt.c.

1343 {
1344  /* Fill out the file slot, if it's not already filled. */
1345  /* We should only have a filled slow when all the work of building */
1346  /* out the data is complete, so after a serialize/deserialize cycle */
1347  /* or after a context combine */
1348  size_t len;
1349  bytea *ba;
1350 
1351  if (!ctx->tile)
1352  {
1353  ctx->tile = mvt_ctx_to_tile(ctx);
1354  }
1355 
1356  /* Zero features => empty bytea output */
1357  if (ctx && ctx->layer && ctx->layer->n_features == 0)
1358  {
1359  bytea *ba = palloc(VARHDRSZ);
1360  SET_VARSIZE(ba, VARHDRSZ);
1361  return ba;
1362  }
1363 
1364  /* Serialize the Tile */
1365  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
1366  ba = palloc(len);
1367  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
1368  SET_VARSIZE(ba, len);
1369  return ba;
1370 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:1327
VectorTile__Tile__Layer * layer
Definition: mvt.h:67
VectorTile__Tile * tile
Definition: mvt.h:68

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: