OpenStreetMap

Improving the OSM map - why don't we? [7]

Posted by marczoutendijk on 28 July 2015 in English. Last updated on 23 April 2017.

How do we deal with multiple values for a key?

We all know this situation: you need to add a telephone number to a node and add the line:
phone=00311198765432
Then you find out that there is a second phone number for that node, but you can’t add a second phone= tag because OSM doesn’t allow that.
The general question is: how do I tag multiple values for one key?
Let’s investigate how mappers have solved that problem sofar. The screenshots all are made with OpenPoiMap.


[1]
This example is the Eiffel tower in Paris for which four architects worked together, but only one gave his name to the final product!
In the source the names are separated with semicolons:
Stephen Sauvestre;Gustave Eiffel;Maurice Koechlin;Émile Nouguier


[2] One piece of art created by 5 artists (somewhere in Seattle).
Create a new key with a sequential number attached to it for every member of this group. In this specific case I would have started numbering with artist_number_2 because the first one is already in artist_name. Even better, I would have started with artist_name_1 and used it for Andrew Keating and would have omitted artist_name altogether.


[3] This example is to show how to map multiple sets of related tags to one node. In this case we have man_made=mast which has attached to it 4 (mobile phone) antennas at different heigth and each working with a different technology.
An underscore could have been used as in the previous example, but there seems to be a tendency to tag situations like this with a key:N notation, where N is running over the natural numbers.


[4] Here we see a combination of both methods. Adding a number (with underscore) at the end of the key to count them or adding the number after the colon. Again, in the case of the fuel I would have started with fuel:diesel:1 for the Biosolar.

Any different opinions on this subject?

Discussion

Comment from d1g on 28 July 2015 at 20:15

Allow custom XML in OSM API. It was suggested 3 years ago, but still no progress in that direction: string[255]=string[255] is complete nonse today. This limitation was okay 5 or 10 years ago when OSM was only used in Garmins.

<element>
<type class="amenity-fuel">
<name>1st name</name>
<name>2nd name</name>
<fuels>
  <fuel brand="Biosolar" price="...">Diesel</fuel>
  <fuel brand="Pertamina Dex" price="...">Diesel</fuel>
</fuels>
</type>
<type class="amenity-bar">
<description>also bar</description>
</type>
</element>

Simple editor for XML already here: https://eclipse.org/vex/ - it will autocomplete everything for you in any place of XML DTD.

Comment from Alan Trick on 29 July 2015 at 19:30

I don’t see any reason why you couldn’t have duplicate key-value pairs in the current api; however, I think it’s disallowed because of limitations elsewhere. Also, this would violate current expectations that other tools have (for example, the rendering of a road shows the name of the road along side of it, but if there are two names, which name does it pick?)

Comment from d1g on 2 August 2015 at 21:06

https://wiki.openstreetmap.org/wiki/API_v0.7#Multiple_Tags - here is 4 year old link, vote for it, bring more attention to the problem

Comment from leodobrasil on 10 August 2015 at 13:29

There is also the often used workaround to separate the values by semicolons.

Comment from marczoutendijk on 10 August 2015 at 13:46

@leodobrasil See my nr. 1 example! Below the picture is the explanation with semicolons. You obviously missed it.

Comment from leodobrasil on 10 August 2015 at 13:47

Sorry you have already mentioned it - and now I cannot remove my previous comment.

Log in to leave a comment