NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

If I want to store an identifier to a particular location in OSM, what's the best way to do this please?

For example:

If I want to store the link to Hyde Park, I can use this: Way: Hyde Park (372975520) https://www.openstreetmap.org/way/372975520

Whereas if I want to store a link to Wimbledon Common, it's listed as this: Relation: Wimbledon Common (4285108) https://www.openstreetmap.org/relation/4285108

Note that one is a Way and the other is a Relation. Are these numbers still useful as UIDs? Or should I be storing the ID and the type (Way/Relation etc)?

Any guidance appreciated!

asked 02 Jan '20, 11:24

ab76555's gravatar image

ab76555
31113
accept rate: 0%

For completeness, if you just want to store a link to a location, you can store what's in the browser URL (for Hyde Park at zoom 15 that's https://www.openstreetmap.org/#map=15/51.5070/-0.1729 ). That's not linking to a particular object in OSM but is linking to a location.

(02 Jan '20, 11:31) SomeoneElse ♦

Thanks for the quick reply! What if I do want access to OSM object too? For example, if I've got a database that stores locations alongside ratings (which I'm accessing through my API), and I occasionally want to access the OSM object (for example, I might query my_location_id/osm_object_coordinates).

(02 Jan '20, 11:47) ab76555
1

escada's answer covers the aspect of permanent linking. Regarding your question about the way and relation IDs, each object type has its own numbering. That is, there's a node #1, way #1, and relation #1, all representing different things. So, to identify an object using its ID, you'd also need to record its object type.

(02 Jan '20, 17:22) alester
1

Brilliant - thanks all for your help. That's great to know about the node/way numbering!

(03 Jan '20, 09:25) ab76555

Since IDs can change, there is no definite solution. There are some workarounds (e.g. using Wikidata) listed on the wiki page Permanent ID

permanent link

answered 02 Jan '20, 13:44

escada's gravatar image

escada
19.0k16166302
accept rate: 21%

edited 02 Jan '20, 13:45

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×4

question asked: 02 Jan '20, 11:24

question was seen: 1,117 times

last updated: 03 Jan '20, 09:25

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum