[GIS] How to get a list of OSM relations (id numbers) of cities and countries only

countyopenstreetmappolygon

I want to get OSM polygon shapes (GEOJson or WKT) of countries and cities only. I know that it is called a "relation" in OSM and each relation has its own id (New York is 175905, for example). How may I get a list of ids of all existing city and country relations in OSM? Is there same standard like numbers from 50.000 – 100.000 are countries and numbers from 300.000 – 500.000 are cities?

The best is to have something like a table:

OSM relation id | area name | type
175905          | New York  | city
1403916         | France    | country

Best Answer

Export of boundaries as various formats (shp, geojson, etc.) is possible using https://wambachers-osm.website/boundaries/ . It requires OAuth login with an OSM account.

You will find a list of defective boundaries at https://wambachers-osm.website/index.php/projekte/internationale-administrative-grenzen/missing-boundaries and the subpages. These are used as a quality improvement tool.

Disclaimer: It's not my tool.

Related Question