Skip to content

Assign fallback unique ID to region features after duplicate id removal #198

@napakalas

Description

@napakalas

When processing features with a region property, the id is intentionally removed to prevent duplicate IDs:

# So that any region doesn't have a duplicate id
region_properties.pop('id', None)
region_properties.pop('userdata', None)
region = self.flatmap.new_feature(self.id, feature.geometry.representative_point(), region_properties)

However, this results in region features having no identifier at all. For example, UBERON:0001161 (body of stomach)

This impacts path handling. For example, portal/2 passes through UBERON:0001161, but without an id, the system cannot determine whether the region is present or associated with the path.

Proposed Solution
Assign a fallback unique ID (e.g., based on featureId or UBERON ID or CLASS ID) when adding region features to layer_features.
This preserves the original intent (no duplicate IDs) while ensuring regions remain identifiable for downstream logic.

Missing id for UBERON:0001161:

"868": {
    "class": "digestive_18",
    "tile-layer": "features",
    "name": "body of stomach",
    "label": "body of stomach",
    "minzoom": 0,
    "featureId": 868,
    "models": "UBERON:0001161",
    "bounds": [
        3.1202072103334273,
        -3.957220372623511,
        4.266365794272358,
        -2.1002029334923114
    ],
    "markerPosition": [
        3.751318297275743,
        -2.9706798580850613
    ],
    "geometry": "Polygon",
    "layer": "whole-rat",
    "anatomical-nodes": [
        "[\"UBERON:0001161\", []]"
    ]
}
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions