PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ mvt_ctx_to_bytea()

static bytea* mvt_ctx_to_bytea ( mvt_agg_context ctx)
static

Definition at line 903 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().

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