IDs & kinds
Stable ids you can store, and one vocabulary for places across countries.
Boundary ids
A boundary's id is its OpenStreetMap id: r plus the relation id, or w plus the way id. It's stable, and you can open any boundary on openstreetmap.org to check it. Inputs accept these forms; responses always use the canonical one:
| Input | Meaning |
|---|---|
| r62422 | Canonical: an OSM relation (Berlin) |
| w123456 | Canonical: a boundary drawn as one closed OSM way |
| zcta-11249 | Canonical: a US ZIP code area (Census ZCTA, not from OSM) |
| zcta:11249, zip:11249, ZCTA5 11249 | Spellings of a ZIP code area id |
| tz-america-new_york | Canonical: an IANA time zone (timezone-boundary-builder, from OSM data; + is spelled plus: tz-etc-gmtplus5) |
| America/New_York, tz:America/New_York | Spellings of a time zone id |
| eez-8456 | Canonical: an Exclusive Economic Zone by its Marine Regions id (not from OSM) |
| eez:8456, mrgid:8456 | Spellings of a maritime zone id |
| cbsa-35620, csa-408 | Canonical: a US metro or micro area by its CBSA code, a combined statistical area by its CSA code (Census TIGER/Line) |
| cd-3610 | Canonical: a US congressional district of the current Congress, state FIPS + district (NY-10; 00 at-large, 98 a delegate) |
| sd-0622710 | Canonical: a US school district (unified, elementary or secondary) by its NCES LEA id |
| cdp-1208150 | Canonical: a US census-designated place, an unincorporated community, by its place GEOID |
| cbsa:35620, CD 3610, sd:0622710 | Spellings of a Census area id |
| wof-85857853 | Canonical: a neighbourhood outline from Who's On First, by its WOF id (not from OSM) |
| wof:85857853, whosonfirst:85857853 | Spellings of a neighbourhood outline id |
| ons-E05013809 | Canonical: a UK electoral ward, Westminster constituency or census area by its ONS GSS code (not from OSM) |
| ons:E05013809, gss:E05013809, E05013809 | Spellings of a UK area id |
| R62422, relation/62422, rel 62422 | Common spellings |
| -62422 | osm2pgsql's negative relation ids |
| https://www.openstreetmap.org/relation/62422 | An osm.org URL |
| wikidata:Q64 | A Wikidata item |
| iso:US-CA, iso:DE | ISO 3166-2 or 3166-1 code |
Wikidata and ISO ids are looked up once, then answered from our table.
Kinds
OSM's admin_level means different things per country: level 4 is a US state, a French region and a Japanese prefecture; level 8 is a German Gemeinde and a US city. Each boundary also has a kind from one vocabulary, so you can filter the same way everywhere:
country, state, region, province, county, district, municipality, city, borough, ward, neighbourhood, postal_code, airport, timezone, eez, metro_area, micro_area, combined_statistical_area, congressional_district, school_district, census_place, constituency, census_area.
Level 2 is always country, and postcode areas are postal_code. Time zones (timezone) and Exclusive Economic Zones (eez) have no level: they cover the world as layers of their own, and reverse_boundaries lists them after a point's chain. So do the US Census areas: metro_area, micro_area, combined_statistical_area, congressional_district, school_district and census_place (a census-designated place). Below that, a sample:
| Country | Level 4 | Level 5 | Level 6 | Level 7 | Level 8 | Level 9 | Level 10 |
|---|---|---|---|---|---|---|---|
| US | state | region | county | municipality | city | ward | neighbourhood |
| GB | region | region | county | district | district | ward | ward |
| DE | state | region | district | municipality | municipality | borough | neighbourhood |
| FR | region | region | county | district | municipality | borough | neighbourhood |
| ES | region | region | province | district | municipality | district | neighbourhood |
| JP | province | region | county | municipality | borough | neighbourhood | neighbourhood |
| IN | state | district | district | district | city | ward | neighbourhood |
| BR | state | region | county | region | municipality | district | neighbourhood |
| AU | state | region | municipality | district | municipality | neighbourhood | neighbourhood |
| Other | state | region | county | district | municipality | borough | neighbourhood |
A municipality OSM tags as a city becomes city. Filter search with kind, or with admin_level when you need OSM's own level.