PostGIS  3.4.0dev-r@@SVN_REVISION@@
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages

◆ set_feature_id()

static void set_feature_id ( mvt_agg_context ctx,
struct feature_builder feature,
Datum  datum,
bool  isNull 
)
static

Sets the feature id.

Ignores Nulls and negative values

Definition at line 633 of file mvt.c.

634 {
635  Oid typoid = ctx->column_cache.column_oid[ctx->id_index];
636  int64_t value = INT64_MIN;
637 
638  if (isNull)
639  {
640  POSTGIS_DEBUG(3, "set_feature_id: Ignored null value");
641  return;
642  }
643 
644  switch (typoid)
645  {
646  case INT2OID:
647  value = DatumGetInt16(datum);
648  break;
649  case INT4OID:
650  value = DatumGetInt32(datum);
651  break;
652  case INT8OID:
653  value = DatumGetInt64(datum);
654  break;
655  default:
656  elog(ERROR, "set_feature_id: Feature id type does not match");
657  }
658 
659  if (value < 0)
660  {
661  POSTGIS_DEBUG(3, "set_feature_id: Ignored negative value");
662  return;
663  }
664 
665  feature->has_id = true;
666  feature->id = (uint64_t) value;
667 }
int value
Definition: genraster.py:62
bool has_id
Definition: mvt.c:84
uint64_t id
Definition: mvt.c:85
uint32_t id_index
Definition: mvt.h:68
mvt_column_cache column_cache
Definition: mvt.h:98
uint32_t * column_oid
Definition: mvt.h:51

References mvt_agg_context::column_cache, mvt_column_cache::column_oid, feature_builder::has_id, feature_builder::id, mvt_agg_context::id_index, and genraster::value.

Referenced by parse_values().

Here is the caller graph for this function: