Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Place label parsing is broken

Open
#47 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
45/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
csharp
Domain
backend

Research direction

Start in VectorTileFeatures.cs at GetProperties() and reproduce the duplicate-key case with the mapbox-streets-v7 or mapbox-streets-v8 tileset. Ensure duplicate properties no longer cause parsing to throw, while uneven tag counts still report an error; adapt the warning behavior appropriately for this project rather than relying on Unity logging.

Written by the indexing model from the issue text.

Description

Right now using the mapbox-streets-v7 and mapbox-streets-v8 tile-sets querying place labels throws excpetions when parsing properties. The exception happens when the API returns duplicated keys. For example for the class property it returns both country and disputed_country.

The problematic code is in VectorTileFeatures.cs GetProperties() method

public Dictionary<string, object> GetProperties()
{

    if (0 != Tags.Count % 2)
    {
        throw new Exception(string.Format("Layer [{0}]: uneven number of feature tag ids", _layer.Name));
    }
    Dictionary<string, object> properties = new Dictionary<string, object>();
    int tagCount = Tags.Count;
    for (int i = 0; i < tagCount; i += 2)
    {
        properties.Add(_layer.Keys[Tags[i]], _layer.Values[Tags[i + 1]]);
    }
    return properties;
}

Suggested fix:

public Dictionary<string, object> GetProperties()
{
    if (Tags.Count % 2 != 0) throw new InvalidOperationException($"Layer [{_layer.Name}]: uneven number of feature tag ids");
    var properties = new Dictionary<string, object>();
    var tagCount = Tags.Count;
    for (var i = 0; i < tagCount; i += 2)
    {
        var key = _layer.Keys[Tags[i]];
        var value = _layer.Values[Tags[i + 1]];

        if (properties.TryGetValue(key, out var oldValue))
        {
            if (Equals(value, oldValue))
            {
                continue;
            }
            else
            {
                // To work around the issue we started using this projects source directly in Unity. This logging should be different in the actual fix
                UnityEngine.Debug.LogWarning($"Overriding tile property. Key: {key}, Old value: {properties[key]}, New value: {value}");
            }
        }

        properties[key] = value;
    }
    return properties;
}
Dominant language
C#
Stars
64
Forks
38
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mapbox/vector-tile-cs

All issues in mapbox/vector-tile-cs

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.