PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ pgis_asmvt_transfn()

Datum pgis_asmvt_transfn ( PG_FUNCTION_ARGS  )

Definition at line 79 of file lwgeom_out_mvt.c.

80 {
81 #ifndef HAVE_LIBPROTOBUF
82  elog(ERROR, "Missing libprotobuf-c");
83  PG_RETURN_NULL();
84 #else
85  MemoryContext aggcontext;
86  mvt_agg_context *ctx;
87 
88  if (!AggCheckCallContext(fcinfo, &aggcontext))
89  elog(ERROR, "%s called in non-aggregate context", __func__);
90  MemoryContextSwitchTo(aggcontext);
91 
92  if (PG_ARGISNULL(0)) {
93  ctx = palloc(sizeof(*ctx));
94  ctx->name = "default";
95  if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
96  ctx->name = text_to_cstring(PG_GETARG_TEXT_P(2));
97  ctx->extent = 4096;
98  if (PG_NARGS() > 3 && !PG_ARGISNULL(3))
99  ctx->extent = PG_GETARG_INT32(3);
100  ctx->geom_name = NULL;
101  if (PG_NARGS() > 4 && !PG_ARGISNULL(4))
102  ctx->geom_name = text_to_cstring(PG_GETARG_TEXT_P(4));
104  } else {
105  ctx = (mvt_agg_context *) PG_GETARG_POINTER(0);
106  }
107 
108  if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
109  elog(ERROR, "%s: parameter row cannot be other than a rowtype", __func__);
110  ctx->row = PG_GETARG_HEAPTUPLEHEADER(1);
111 
112  mvt_agg_transfn(ctx);
113  PG_FREE_IF_COPY(ctx->row, 1);
114  PG_RETURN_POINTER(ctx);
115 #endif
116 }
void mvt_agg_init_context(mvt_agg_context *ctx)
Initialize aggregation context.
Definition: mvt.c:1144
void mvt_agg_transfn(mvt_agg_context *ctx)
Aggregation step.
Definition: mvt.c:1187
char * text_to_cstring(const text *textptr)
char * geom_name
Definition: mvt.h:62
uint32_t extent
Definition: mvt.h:61
HeapTupleHeader row
Definition: mvt.h:64
char * name
Definition: mvt.h:60

References mvt_agg_context::extent, mvt_agg_context::geom_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: