PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ pgis_asmvt_transfn()

Datum pgis_asmvt_transfn ( PG_FUNCTION_ARGS  )

Definition at line 79 of file lwgeom_out_mvt.c.

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, PG_FUNCTION_INFO_V1(), pgis_asmvt_finalfn(), mvt_agg_context::row, and text_to_cstring().

Referenced by ST_AsMVTGeom().

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));
103  if (PG_NARGS() > 5 && !PG_ARGISNULL(5))
104  ctx->id_name = text_to_cstring(PG_GETARG_TEXT_P(5));
105  else
106  ctx->id_name = NULL;
108  } else {
109  ctx = (mvt_agg_context *) PG_GETARG_POINTER(0);
110  }
111 
112  if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
113  elog(ERROR, "%s: parameter row cannot be other than a rowtype", __func__);
114  ctx->row = PG_GETARG_HEAPTUPLEHEADER(1);
115 
116  mvt_agg_transfn(ctx);
117  PG_FREE_IF_COPY(ctx->row, 1);
118  PG_RETURN_POINTER(ctx);
119 #endif
120 }
HeapTupleHeader row
Definition: mvt.h:66
char * text_to_cstring(const text *textptr)
char * name
Definition: mvt.h:60
char * id_name
Definition: mvt.h:62
char * geom_name
Definition: mvt.h:64
uint32_t extent
Definition: mvt.h:61
void mvt_agg_init_context(mvt_agg_context *ctx)
Initialize aggregation context.
Definition: mvt.c:959
void mvt_agg_transfn(mvt_agg_context *ctx)
Aggregation step.
Definition: mvt.c:1003
Here is the call graph for this function:
Here is the caller graph for this function: