Unity-GeoJSONObject
Unity-GeoJSONObject copied to clipboard
Duplicate properties in the JSON cause a dictionary duplicate Key error
If there are multiple property keys with the same name i.e.: "properties": { "id": 1, "lyr": "CityVerveBorderb-6yknyc", "id": "1" } Unity will throw a error.
Can be resolved by updating parseProperties() in FeatureObject.cs to the following:
protected void parseProperties(JSONObject jsonObject) { for(int i = 0; i < jsonObject.list.Count; i++){ string key = (string)jsonObject.keys[i]; JSONObject value = (JSONObject)jsonObject.list[i]; try { properties.Add(key, value.str); } catch { Debug.LogWarning("Duplicate Key: " + key + " in properties"); } } }
Thanks, that's a good point! I'll take a look and fix that.
Regards, Timo