OsmTravel / OsmGo

Osm Go !
https://osmgo.com/
MIT License
109 stars 15 forks source link

Duplicate tags in presets.json once with _ once with : #125

Open Binnette opened 2 years ago

Binnette commented 2 years ago

Hi @DoFabien,

For now, I don't understand that much the structure of the file presets.json, but I think I found some 'incoherence'.

Here are some example of duplicates key, once with : once with _:

  "addr:housenumber": {
    "key": "addr:housenumber",
    "lbl": {
      "en": "House number",
      "fr": "Numero de rue"
    },
    "type": "text"
  },
  "addr:street": {
    "key": "addr:street",
    "lbl": {
      "en": "Street",
      "fr": "Rue"
    },
    "type": "text"
  },
  "addr_housenumber": {
    "key": "addr:housenumber",
    "type": "text",
    "lbl": {
      "de": "addr:housenumber",
      "en": "addr_housenumber"
    }
  },
  "addr_street": {
    "key": "addr:street",
    "type": "text",
    "lbl": {
      "de": "addr:street",
      "en": "addr_street"
    }
  },

Questions:

  1. Can we delete the _ variants? Or do they serve any purpose?
  2. Why addr:city, addr:country, addr:postcode are missing?

In fact, I think I need more explanations on the tags.json and presets.json. What is the purpose of each file?

Once I understand it better, I think we can recreate them completely from id_tagging_schema and taginfo.

DoFabien commented 2 years ago

Hi, This is due to the fact that at the very beginning, in 2015, the tags were handwritten, the identifiers with "_" come from that time...

The "tags" refer to "presets" according to their "id" (the key of the preset object).

There can potentially be presets with the same key/value but different attributes, depending on the object to qualify, but if it exists, it's very rare

Ex of a tag :

{
      "id": "building/commercial",
      "icon": "maki-suitcase",
      "markerColor": "#5A5A5A",
      "presets": [
        "smoking",
        "levels",
        "roof:levels",
        "addr:housenumber",  <--------------------
        "addr:street"
      ]
}
  "addr:housenumber": {
    "key": "addr:housenumber",
    "lbl": {"en": "House number", "fr": "Numero de rue"},
    "type": "text"
  }

The preset id "addr_housenumber" is not used in any tag, we can delete it. We should write tests for these cases and to make sure that every preset used in the tags exists.

Why addr:city, addr:country, addr:postcode are missing?

I think it's useless, the municipalities can change from one year to another, and in fact, if we want to get the municipalities and the postal codes, we do a simple spatial query... Don't you think?