Permanent ID for OSM: Unterschied zwischen den Versionen

Aus Geoinformation HSR
Wechseln zu: Navigation, Suche
K (OSM Permanent ID with geo URL)
K (OSM Permanent ID with geo URL)
Zeile 28: Zeile 28:
 
# OSM Permanent ID with geo URL. Example 'geo:47.45835,8.74375 ?q=relation/1169711#5'.
 
# OSM Permanent ID with geo URL. Example 'geo:47.45835,8.74375 ?q=relation/1169711#5'.
  
== OSM Permanent ID with geo URL ==
+
== OSM Permanent ID with geo URI ==
  
 
The goals and requirements of this new proposal are to get a compact human readable string as an OSM id.  
 
The goals and requirements of this new proposal are to get a compact human readable string as an OSM id.  

Version vom 22. Juli 2020, 21:47 Uhr

 This is an unofficial proposal for a "OSM permanent ID" (osm_pid) for OpenStreetMap (OSM). 
 
 See https://wiki.openstreetmap.org/wiki/Permanent_ID for an official place for discussions. 

Status of OSM id

One can use OSM id nevertheless (at own risk)! Many variants are known:

As is with OSM id (bigint) and 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" https://www.openstreetmap.org/node/6313169265):

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 [1]). Example: "Schloss Kyburg" is a relation with id 1169711, so it becomes 11697114.

 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).

Recommendations

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 URL. Example 'geo:47.45835,8.74375 ?q=relation/1169711#5'.

OSM Permanent ID with geo URI

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:

 'geo:'[+|-]<lon>[+|-]<lat>'?q='[node|way|relation]'/'<osm_id>#<osm_version>

where:

  • 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 a maximum of 6 digits. In case of a line (linestring) or an area (multipolygon relation) geometries, the coordinates taken into account are the lat/lon minimum 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):

 geo:47.45835,8.74375?q=relation/1169711#5

There's an implementation by Mangrove.reviews 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' 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: https://wiki.openstreetmap.org/wiki/Overpass_API/Permanent_ID

Example for Castle Kyburg: '[out:custom];rel[wikidata=Q573643];out;' => Q573643

Others

  • 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.