PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ pgis_asmvt_transfn()

Datum pgis_asmvt_transfn ( PG_FUNCTION_ARGS  )

Definition at line 78 of file lwgeom_out_mvt.c.

References mvt_agg_context::extent, mvt_agg_context::geom_name, mvt_agg_init_context(), mvt_agg_transfn(), mvt_agg_context::name, PG_FUNCTION_INFO_V1(), pgis_asmvt_finalfn(), and mvt_agg_context::row.

Referenced by ST_AsMVTGeom().

79 {
80 #ifndef HAVE_LIBPROTOBUF
81  elog(ERROR, "Missing libprotobuf-c");
82  PG_RETURN_NULL();
83 #else
84  MemoryContext aggcontext;
85  struct mvt_agg_context *ctx;
86 
87  if (!AggCheckCallContext(fcinfo, &aggcontext))
88  elog(ERROR, "pgis_asmvt_transfn: called in non-aggregate context");
89  MemoryContextSwitchTo(aggcontext);
90 
91  if (PG_ARGISNULL(0)) {
92  ctx = palloc(sizeof(*ctx));
93  ctx->name = "default";
94  if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
95  ctx->name = text_to_cstring(PG_GETARG_TEXT_P(2));
96  ctx->extent = 4096;
97  if (PG_NARGS() > 3 && !PG_ARGISNULL(3))
98  ctx->extent = PG_GETARG_INT32(3);
99  ctx->geom_name = NULL;
100  if (PG_NARGS() > 4 && !PG_ARGISNULL(4))
101  ctx->geom_name = text_to_cstring(PG_GETARG_TEXT_P(4));
103  } else {
104  ctx = (struct mvt_agg_context *) PG_GETARG_POINTER(0);
105  }
106 
107  if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
108  elog(ERROR, "pgis_asmvt_transfn: parameter row cannot be other than a rowtype");
109  ctx->row = PG_GETARG_HEAPTUPLEHEADER(1);
110 
111  mvt_agg_transfn(ctx);
112  PG_FREE_IF_COPY(ctx->row, 1);
113  PG_RETURN_POINTER(ctx);
114 #endif
115 }
HeapTupleHeader row
Definition: mvt.h:54
char * name
Definition: mvt.h:50
char * geom_name
Definition: mvt.h:52
void mvt_agg_init_context(struct mvt_agg_context *ctx)
Initialize aggregation context.
Definition: mvt.c:848
uint32_t extent
Definition: mvt.h:51
void mvt_agg_transfn(struct mvt_agg_context *ctx)
Aggregation step.
Definition: mvt.c:888
Here is the call graph for this function:
Here is the caller graph for this function: