Taginfo is a way of finding out what tags and values are used within OpenStreetMap. There’s a worldwide instance here, and other instances exist, including various Geofabrik ones such as Antarctica here.

As well as describing keys and values used within OpenStreetMap, the worldwide instance of Taginfo also holds details of what other projects use particular OSM tags. The Taginfo/Projects page explains the update process.

Each project submits a .json file containing details of key and value usage, such as this one for an OSM Mug.

The one for the map style that I look after is here. Currently I’ve just submitted a list of keys, not values, but I have included a description for each one, as can be seen here for “designation”.

The first challenge was to create the initial list. There are references to tags in three main places in my map style - the lua style file, the carto .mml file and the individual carto .mss files such as this one. A bit of investigation (creating a unique sorted list of strings within style.lua on one hand and .mml and .mss files on the other found that although some keys do pass through style.lua unchanged, almost no keys that are later used in carto files aren’t mentioned in style.lua at all. That means that I only needed to worry about keys in style.lua. I created an initial .json in the correct format and then wrote a shell script to generate the “tags:” section of the .json file. I then filled in the descriptions where the shell script had just created placeholders, and checked it in.

Next, I wanted to be able to easily update the taginfo.json file after changes to the map style. Because I’ve also checked the previous generated file into github I can easily create a new one and compare the two:

sh -x ./ > q.txt
diff taginfo_lua_nodesc.txt q.txt

for the most recent change the output of that is:

>     { "key": "colour", "description": "qqq" }
>     { "key": "lifeguard", "description": "qqq" }
>     { "key": "locked", "description": "qqq" }
>     { "key": "place_of_worship", "description": "qqq" }

So next I need to:

  • Update the file with descriptions with those keys (taking care to make sure that the JSON is still valid, and that lines which need a comma on the end have one).
  • Move the new output file (q.txt) in this example into place as the new “taginfo_lua_nodesc.txt”.
  • Update taginfo.json with a new “data_updated” date at the top.
  • Check everything in
  • Ensure that within a day or so it’s updated in the project list.

In some cases the description can be obtained directly from the commit text, such as for “colour” here:

Show black, white, blue, green, grey and gold phone boxes as the correct colour rather than red.

Once that’s done, taginfo should update within a day or so, and updates will appear on pages such as this one. At the time of writing this diary entry, there are no projects listed for that key.

Then in a month or so’s time, after the next map style update, repeat the process.

Location: Old Town, Hull, Kingston upon Hull, England, HU1 1JE, United Kingdom


Login to leave a comment