PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 1304 of file mvt.c.

1305 {
1306  /* Fill out the file slot, if it's not already filled. */
1307  /* We should only have a filled slow when all the work of building */
1308  /* out the data is complete, so after a serialize/deserialize cycle */
1309  /* or after a context combine */
1310  size_t len;
1311  bytea *ba;
1312 
1313  if (!ctx->tile)
1314  {
1315  ctx->tile = mvt_ctx_to_tile(ctx);
1316  }
1317 
1318  /* Zero features => empty bytea output */
1319  if (ctx && ctx->layer && ctx->layer->n_features == 0)
1320  {
1321  bytea *ba = palloc(VARHDRSZ);
1322  SET_VARSIZE(ba, VARHDRSZ);
1323  return ba;
1324  }
1325 
1326  /* Serialize the Tile */
1327  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
1328  ba = palloc(len);
1329  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
1330  SET_VARSIZE(ba, len);
1331  return ba;
1332 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:1289
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: