PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 902 of file mvt.c.

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

Referenced by mvt_agg_finalfn(), and mvt_ctx_serialize().

903 {
904  /* Fill out the file slot, if it's not already filled. */
905  /* We should only have a filled slow when all the work of building */
906  /* out the data is complete, so after a serialize/deserialize cycle */
907  /* or after a context combine */
908  size_t len;
909  bytea *ba;
910 
911  if (!ctx->tile)
912  {
913  ctx->tile = mvt_ctx_to_tile(ctx);
914  }
915 
916  /* Zero features => empty bytea output */
917  if (ctx && ctx->layer && ctx->layer->n_features == 0)
918  {
919  bytea *ba = palloc(VARHDRSZ);
920  SET_VARSIZE(ba, VARHDRSZ);
921  return ba;
922  }
923 
924  /* Serialize the Tile */
925  len = VARHDRSZ + vector_tile__tile__get_packed_size(ctx->tile);
926  ba = palloc(len);
927  vector_tile__tile__pack(ctx->tile, (uint8_t*)VARDATA(ba));
928  SET_VARSIZE(ba, len);
929  return ba;
930 }
static VectorTile__Tile * mvt_ctx_to_tile(mvt_agg_context *ctx)
Definition: mvt.c:887
VectorTile__Tile * tile
Definition: mvt.h:57
VectorTile__Tile__Layer * layer
Definition: mvt.h:56
unsigned char uint8_t
Definition: uthash.h:79
Here is the call graph for this function:
Here is the caller graph for this function: