Skip to content

Conversation

@mukeshrebari
Copy link

when i was loading pbf file it was throwing this "throw new ArgumentException("A tag with this key already exists.");"

when i was loading pbf file it was throwing this "throw new ArgumentException("A tag with this key already exists.");"
foreach (var tag in tags)
{
if (_vehicleCache.Vehicles.IsOnMetaWhiteList(tag.Key))
if (_vehicleCache.Vehicles.IsOnMetaWhiteList(tag.Key)&&!osmGeo.Tags.ContainsKey(tag.Key))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added checkpoint to avoid inserting duplicate tag.

Copy link

@juliusfriedman juliusfriedman May 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps normalizedTags.Concat(tags).Distinct()

Make 296 just:

foreach (var tag in normalizedTags.Concat(tags).Distinct())
                        {
                            osmGeo.Tags.Add(tag.Key, tag.Value);
                        }

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps also ToHashSet could be used instead... whatever makes more sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants