< Overpass API

Overpass API/Permanent ID

Permanent Links to OSM data

What if you want to link to a specific object in OpenStreetMap? You can but you shouldn't use an object ID, because the OSM IDs may change at any time. This may even happen rather frequently. e.g. if an object is deleted and re-added. Also, every split of a way leaves one half with a different ID than the original way.

The solution is to link to the object with a certain property, usually a certain combination of tags. If a unique object exists, you are redirected to the object's web page at openstreetmap.org. Otherwise, if for example the referred way has been split, a search result page shows all possible objects. As an bonus, you can customize both the link target and the appearance of the result page.

A first example is the oldest German motorway, the A 555 that is the entity Q17061 at Wikidata, so Q17061 is also a "permanent ID", and as reciprocal use it is pointing to the OSM relation 23092. A link to this motorway is for example on the German motorway project page, section A 500 to A 599.

To make linking easy when creating the wiki page, that link is encapsulated in a template. In the wiki page, just write {{DisplayRoute|network=BAB|ref=A 555}}. If you want to describe a route identified by network and ref, you can just fill the template with the values of your object.


One general advice: If you create any new templates on this wiki, suitable for Overpass Queries, please include them in the category Category:Overpass API/Templates so that people can find them and make use of them.

See also

This article is issued from Openstreetmap. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.