Overpass query example

Cities and towns of a country

List places by size with the place tag, including population. Example: Italy.

Settlements are points tagged place=city, town, village or hamlet, usually with population.

The query

[out:json][timeout:60];
area["ISO3166-1"="IT"][admin_level=2]->.it;
node["place"~"^(city|town)$"](area.it);
out;

Run it

Running the query…

Live result from overpass.ch, cached for up to 12 hours. Map data © OpenStreetMap contributors (ODbL).

How it works

  1. place=city and place=town are set by size and importance, not by legal status.
  2. population is a tag on the same point. Many are copied from official statistics.

Variations

  • Big cities only: (if: number(t["population"]) >= 100000).
  • Capitals: ["capital"="yes"].

Run it from your code

curl https://api.overpass.ch/v1/YOUR_API_KEY/interpreter \
  --data-urlencode 'data@query.overpassql'

Save the query as query.overpassql. It works the same in Overpass Turbo, QGIS and JOSM.

More examples

All examples →