mapbox/geojson-vt

Priority of geojson.id is lower than options.generateId

gorshkov-leonid opened this issue · 3 comments

let id = geojson.id;

    var id = geojson.id;
    if (options.promoteId) {
        id = geojson.properties[options.promoteId];
    } else if (options.generateId) {
        id = index || 0;
    }

May be geojson.id should be exclusive?

I think this was intentional, so that ids are consistent across the dataset — either fully user-provided, or fully generated by one of the two options (cc @asheemmamoowala). Mixing both doesn't seem like a good idea. @gorshkov-leonid Can you describe your use case in more detail?

Ok, I agree. Thank you

The case of usage is creation of configuration without extra data. If I want I can add an id, but it is not necessary.

const point1 = {
    id: 0,/*is not necessary in this case, but it can be important to specify concrete id in other cases?*/
    type: "Point", coordinates: randomCoords(1)[0],
    properties: {
        externalId: "point-1",
        label: {
            "label-profile-1": "Label 1",
            "label-profile-2": "Label 2"
        },
        style: {
            "profile-1": {color: "#FF0000",  iconUrl: "/images/mouse.png"}
        }
    }
};

but I think it can cause mistakes.