PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ pgis_asmvt_transfn()

Datum pgis_asmvt_transfn ( PG_FUNCTION_ARGS  )

Definition at line 126 of file lwgeom_out_mvt.c.

127 {
128 #ifndef HAVE_LIBPROTOBUF
129  elog(ERROR, "Missing libprotobuf-c");
130  PG_RETURN_NULL();
131 #else
132  MemoryContext aggcontext;
133  mvt_agg_context *ctx;
134 
135  /* We need to initialize the internal cache to access it later via postgis_oid() */
136  postgis_initialize_cache(fcinfo);
137 
138  if (!AggCheckCallContext(fcinfo, &aggcontext))
139  elog(ERROR, "%s called in non-aggregate context", __func__);
140  MemoryContextSwitchTo(aggcontext);
141 
142  if (PG_ARGISNULL(0)) {
143  ctx = palloc(sizeof(*ctx));
144  ctx->name = "default";
145  if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
146  ctx->name = text_to_cstring(PG_GETARG_TEXT_P(2));
147  ctx->extent = 4096;
148  if (PG_NARGS() > 3 && !PG_ARGISNULL(3))
149  ctx->extent = PG_GETARG_INT32(3);
150  ctx->geom_name = NULL;
151  if (PG_NARGS() > 4 && !PG_ARGISNULL(4))
152  ctx->geom_name = text_to_cstring(PG_GETARG_TEXT_P(4));
153  if (PG_NARGS() > 5 && !PG_ARGISNULL(5))
154  ctx->id_name = text_to_cstring(PG_GETARG_TEXT_P(5));
155  else
156  ctx->id_name = NULL;
158  } else {
159  ctx = (mvt_agg_context *) PG_GETARG_POINTER(0);
160  }
161 
162  if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
163  elog(ERROR, "%s: parameter row cannot be other than a rowtype", __func__);
164  ctx->row = PG_GETARG_HEAPTUPLEHEADER(1);
165 
166  mvt_agg_transfn(ctx);
167  PG_FREE_IF_COPY(ctx->row, 1);
168  PG_RETURN_POINTER(ctx);
169 #endif
170 }
void mvt_agg_init_context(mvt_agg_context *ctx)
Initialize aggregation context.
Definition: mvt.c:1233
void mvt_agg_transfn(mvt_agg_context *ctx)
Aggregation step.
Definition: mvt.c:1277
char * text_to_cstring(const text *textptr)
char * id_name
Definition: mvt.h:61
char * geom_name
Definition: mvt.h:63
uint32_t extent
Definition: mvt.h:60
HeapTupleHeader row
Definition: mvt.h:65
char * name
Definition: mvt.h:59

References mvt_agg_context::extent, mvt_agg_context::geom_name, mvt_agg_context::id_name, mvt_agg_init_context(), mvt_agg_transfn(), mvt_agg_context::name, mvt_agg_context::row, and text_to_cstring().

Here is the call graph for this function: