core icon indicating copy to clipboard operation
core copied to clipboard

DefaultFeatureInterpreter is broken

Open YuriiNskyi opened this issue 4 years ago • 0 comments

Look at this line: https://github.com/OsmSharp/core/blob/develop/src/OsmSharp.Geo/DefaultFeatureInterpreter.cs#L524

private static AttributesTable TagsAndIdToAttributes(ICompleteOsmGeo osmObject)
{
    var attr = osmObject.Tags.ToAttributeTable();
    attr.Add("id", osmObject.Id); // Yes, this line

    return attr;
}

The problem is: what if we already have id tag? It will simply throw ArgumentException from here and your data consumption is broken.

My proposal is to check whether AttributeTable already contains id tag, instead of precipitately adding it.

YuriiNskyi avatar Jul 13 '21 16:07 YuriiNskyi