A tag consists of two items, a key and a value. Tags describe specific features of map elements (nodes, ways, or relations) or changesets. Both items are free format text fields, but often represent numeric or other structured items. Conventions are agreed on the meaning and use of tags, which are captured on this wiki.
Keys and values
Tags are for humans as
key=value: key and value separated by an equals sign. Sometimes, the key or value is surrounded by quotes to avoid confusion:
"key"="value"; the quotes (and, indeed, equals sign) are not part of the tag content.
Tags are applied to elements or changesets (i.e., tagging them) resulting in a collection of tags of any size. However, each collection may only contain a key once. Where a tag is not present, there are often considered to be default values or values inherited from parent elements.
The key, therefore, is used to describe a topic, category, or type of feature (e.g., highway or name). Keys can be qualified with prefixes, infixes, or suffixes (usually, separated with a colon, :), forming super- or sub-categories, or namespace. Common namespaces are language specification and a date namespace specification for name keys.
The value details the specific form of the key-specified feature. Commonly, values are free form text (e.g., name="Jeff Memorial Highway"), one of a set of distinct values (an enumeration; e.g., highway=motorway), multiple values from an enumeration (separated by a semicolon), or a number (integer or decimal), such as a distance.
Here are a few examples used in practice:
- highway=residential a tag with a key of
highwayand a value of
residentialwhich should be used on a way to indicate a road along which people live.
- name=Park Avenue a tag for which the value field is used to convey the name of the particular street
- maxspeed=50 a tag whose value is a numeric speed and speed unit. The unit,
km/h, is implied, but can be explicitly specified; miles per hour can be alternatively specified by appending
mph. Across OSM, metric units are the default.
- maxspeed:forward=* a key that includes a namespace for
maxspeedto further distinguish its meaning.
- name:de:1953-1990=Ernst-Thälmann-Straße a tag with the
namekey suffixed namespaces to specify the German name which was valid in some years.
Finding your tag
The following resources are often used to find an appropriate tag or explore tag usage:
- Map Features – a list of accepted tags grouped by key meaning.
- how to map a – an alphabetic list of real-world objects.
- Taginfo – an site to explore current tag usage in the OSM database, including tag values that are not necessarily documented (but it includes links to this wiki if there is a documentation for a tag)
- Search this wiki or browse its category tags
- TagFinder – Website providing full text search engine for OSM tags. (Also webservices available).
- Look how a similar object at another place is mapped (if you know where it might also exist)
- Read any tags you like
- Search the tagging mailinglist archive or questions about “tagging” at the help site or forum.openstreetmap.org. Of course you also could ask at all three sites (but please only one at a time).
- OSM Semantic Network – a machine-readable structure containing the OSM tags
Use in an editor
Some OSM editors (for example iD, Potlatch 2) hide the tags of objects by default, making them not directly editable; instead users fill-in a form. However, likely all tags can be displayed and edited by entering an "advanced" mode of your editor. For the example editors this feature is named “All tags” (bottom left), in iD, respectively “Advanced”, in Potlatch 2.