PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ 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 632 of file mvt.c.

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

Referenced by parse_values().

Here is the caller graph for this function: