Permanent ID for OSM

Aus Geoinformation HSR
(Weitergeleitet von Permanent ID)
Wechseln zu: Navigation, Suche
 This is an unofficial proposal for a "OSM permanent ID" (osm_pid) for OpenStreetMap (OSM). 
 See for an official place for discussions. 

Status of OSM id

One can use OSM id nevertheless (at own risk)! Many variants are known in order to get a single unique identifier value. Some are of type string and others calculate a value of type big integer.

String type based - using OSM ID number plus a code for Node, Way, Relation e.g. in front (e.g. way/417258377). Currently many applications depend on plain osm_id, eventually preceeded by node,way,relation (or N/W/R), like theses web applications (given example of "Denner Hombrechtikon"

Integer type based - using shifting on the three elements of OSM ID numbers:

  • "Overpass": Overpass uses an own schema to calculate an id of integer-type :
  • "Mapbox Streets V7": Another adoption of osm_id with enhanced type space (length) properties is to convert it to a single big integer: It's possible to encode the type (Node, Way, Relation) into the OSM id as a single integer (64 bit). (Source: Mapbox, see older Version V7 of Mapbox Streets [1]). Example: "Schloss Kyburg" is a relation with id 1169711, so it becomes 11697114. See also OpenMaptiles
 for Nodes: osm_id = <node id> × 10  (eg. 123 → 1230), 
 for Ways: osm_id = (<way id> × 10) + 1  (eg. 123 → 1231), 
 for Relations: osm_id = (<relation id> × 10) + 4  (eg. 123 → 1234).

I, Stefan, prefer W417258377 for a string typed id, and Mapbox Streets V7 for number based.


These is what we currently recommend, depending on the setting (by the exampleof Castle Kyburg, see explanations below):

  1. OSM id with Node-Way-Relation code (at own risk). Example 'relation/1169711'.
  2. Wikidata QID with OSM backlink. Example 'Q573643'.
  3. Overpass Permanent ID with objekt-group-specific ID. Example '[out:custom];rel[wikidata=Q573643];out;'
  4. OSM Permanent ID with geo URI. Example 'geo:47.45835,8.74375?q=relation/1169711#5'.

OSM Permanent ID with geo URI

 This proposal is now also on the official OSM Wiki page:

The goals and requirements of this new proposal are to get a compact human readable string as an OSM id.

  • The OSM id alone is not stable enough (as stated above) and it can represent many concepts (and that's by design in OSM).
  • The version no. of the OSM object is needed which makes clear which tags are (or have been) referred to.
  • Coordinates are needed also, because a change of the way and area geometries does not increment the version number. Coordinates plus parameters fit well to the international 'geo' URI scheme.

Thus, a stable OSM Permanent ID could have the following form using the 'geo' URI scheme:



  • the form 'relation/1169711' is the same as e.g. Overpass JSON output produces as @id.
  • osm_id an unsigned big integer ("digits").
  • osm_version is an unsigned integer with a hash in front.
  • coordinates (lat/lon) are signed floats (always showing the +/- sign), with no more than 6 digits if possible. In case of a line (linestring) or an area (multipolygon relation) geometry, the coordinates either are taken from any node of the geometry, or calculated e.g. from the center of the geometry.

The OSM Permanent ID is mainly numeric plus some fixed tokens and it has a variable length of a maximum of 42 chars.

Example: "Schloss Kyburg" (Castle Kyburg) has relation 1169711, version #5 at coordinates 47.45835, 8.74375 - and becomes following OSM Permanent ID (osm_pid):


There's an implementation by with some different parameters q=<name> and u=30 (u = 'uncertainty' in meters). Example: 'geo:47.45835,8.74375?q=Kyburg&u=30' => [2]

 Note: The geo URI looks like a web link (URL). Unfortunately almost no browser supports this URI 'out of the box', only Android systems.

OSM Permanent ID Service

In order to be really useful, a service should be implemented, which returns most recent object given a possibly old Permanent ID if an object has been changed; thus having another Permanent ID where any of it's parts may have changed (most probably just the version no.). Such a service must have access to the fully planet including the history and it must be reliable and responsive.

Wikidata QID with OSM backlink

If all objects in question are allowed to become a Wikidata (WD) object, add the Wikidata QID with key 'wikidata' to the OSM object. This one-way link from OSM to Wikidata then can be turned into a two way relationship using database techniques of JOINs. On the other hand you can add to a Wikidata object the coordinates (P625) and the OSM relation id (P402). Many mashups of OSM, Wikidata and Wikipedia use this solution, like the castle dossier (Burgen-Dossier) and others.

Example for Castle Kyburg: Q573643.

 Warning: Don't shoehorn all OSM objects to relations just because Wikidata only knows OSM relation id (and no node/way id)!

Overpass API Permanent ID

The Permanent_ID from Overpass is a solution where one expects to see the details (= "Link to Browse Object") and which relies purely on (non-geographic) tags: .

Note that the user has to choose at least coordinates and an "around" parameter in Meters plus an identifying property (i.e. a key or a tag). Without this property e.g. OSM objects can't be disambiguated which are on different levels, like shops or rooms (see below).


Castle "Kyburg":

Castle "Ruine Bernegg":

Restaurant "Mensa OST RJ":

Room "Auditorium OST RJ":

Building "OST RJ Gebäude 4":


  • OpenLR (Location Referencing) - a free spec. by TomTom for linear geometries like streets [3].
  • The geographical object IDs from authorities like Ordnance Survey UK or Swisstopo CH.