---
id: "osm_id"
kind: "datatype"
status: "draft"
is_pii: false
categories: ["geo"]
langs: ["common"]
quality: 80
url: "http://registry.apicrafter.io/datatype/osm_id"
---

# OpenStreetMap element ID (`osm_id`)

> **Draft.** Draft records have not been reviewed yet and may be incomplete or wrong; do not treat them as authoritative for legal or compliance decisions.

Identifier of an OpenStreetMap element, that is a node, a way or a relation. IDs are positive 64-bit integers that are unique only within one element type, so node 100 and way 100 are different objects. Datasets write the ID as a bare number, with a type letter (n, w or r; N, W or R in Nominatim), or as type/number like in OpenStreetMap URLs. osm2pgsql stores relation IDs as negative numbers.

- Personal data (PII): no
- Categories: Geographic identifiers (geo)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:-|[nwrNWR]|(?:node|way|relation)/)?[1-9][0-9]{0,18}$
```

## Examples

- `62422` — Berlin boundary relation, bare number
- `n164979149` — Mount Everest summit node, osmium type letter
- `w32965412` — Statue of Liberty way, osmium type letter
- `R62422` — Berlin boundary relation, Nominatim lookup form
- `relation/51701` — Switzerland boundary relation, OpenStreetMap URL form
- `-62422` — Berlin boundary relation as osm2pgsql stores it
- `0` (invalid example) — IDs start at 1
- `x62422` (invalid example) — unknown element type letter

## Translations

- fr: Identifiant d'objet OpenStreetMap
- ru: Идентификатор объекта OpenStreetMap

## Sources

- doc: <https://wiki.openstreetmap.org/wiki/Elements>
- doc: <https://nominatim.org/release-docs/latest/api/Lookup/>
- doc: <https://docs.osmcode.org/osmium/latest/osmium-getid.html>

## Quality

Score 80/100. Missing: mapping (Wikidata, Schema.org, ...), detector coverage.

JSON: <http://registry.apicrafter.io/api/v1/datatypes/osm_id.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/geo/osm_id.yaml>
