![]() |
VOOZH | about |
A namespace is a prefix, suffix or infix to a key. It can be used in special cases to group closely related keys, or as an additional qualifier for keys. The colon character (':') is used as separator of namespaces in key names. The possible benefits of introducing namespaced keys must be weighed against their disadvantages.
Grouping of closely related keys in namespaces helps to separate this group of keys, avoiding naming clashes and provides a higher level context to a particular key.
Namespaces as qualifiers are used when an attribute (such as language code) is applicable for a wide range of unrelated main keys.
Technically both concepts are treated to a large extent the same – key names containing a colon separator are strings of characters just like any other key.
Storing a value in a manner, similar to a namespace syntax i.e. where suffix equals to some variable value, not serving a grouping purpose, does not mean that namespace concept is utilized here. It's just a colon-delimited suffix.
addr:*=* tags to contain part of an addresscontact:*=* tagsgenerator:output=* to provide information about the power output of an electricity power generating plant.is_in=* old namespace that is still present in databaseparking:left=*, parking:right=* or parking:both=* to provide information about parking lanes for highway=*source=* to indicate source of all tags or only specific tagtraffic:hourly=* indicate traffic density and can be used as namespace.| Namespace | Description | List overview of distribution |
|---|---|---|
| capacity: | Describes the capacity a facility is suitable for. | taginfo capacity:* |
This wiki's software is also using the concept of namespaces but this is unrelated to the concept of "namespaces" in keys and tags used in the OpenStreetMap database.
At a basic level within the system, a key with a namespace will just be stored and treated as any other free-form text string (a string which just happens to have a colon character).
Many consumers of OSM data will treat keys like this. Consuming applications often match on keys they are interested in, and any unrecognised keys are ignored. This may indeed be the desired effect of a namespace. Namespaces can be used to separate out certain types of specialist information, side-lining this data away from the 'core' map data, to make it clearer that only more specialist consumers will be interested in it.
Namespacing is a great way to structure the data scheme, but it can also cause troubles for some data consumers, they call it over-namespacing.
For the most frequent Map Features (i.e. the most regular tags which new mappers will use most often) simple keys (without any namespaces) are prevalent.
In some cases, it still possible to use generic notation without clashes. For example, model=* vs. siren:model=*. Both keys indicates a model, but model=* is shorter and applicable to any relevant feature, not only sirens.