Overpass API query examples
93 ready-to-run queries, each explained line by line. They run live on our full-planet server, so you see the real result. Copy one, change the place or the tags, and you're done.
Getting started
The building blocks: bounding boxes, areas, radius searches and output modes.
Your first query: cafés in a bounding box
The simplest useful Overpass query: every café inside a rectangle of latitudes and longitudes, with a line-by-line explanation.
Search inside a city by name
Use area["name"=…] to search inside the real boundary of a city instead of a rectangle. Example: every bakery in Vienna.
Everything within a radius of a point
Find features within a distance of a coordinate with the around filter. Example: pharmacies within 1 km of Times Square.
Nodes, ways and relations at once (nwr)
Why your query misses half the results and how nwr with out center fixes it. Example: every car park in Bern.
One bounding box for the whole query
Set a bounding box once in the settings line instead of repeating it in every statement. Example: benches and waste baskets in the old town of Bern.
Several tags at once (union)
Combine several searches with a union to find features tagged in different ways. Example: all drinking water sources in Zürich.
Food & drink
Cafés, restaurants, pubs, bakeries and drinking water.
Drinking water fountains in a city
Find every public drinking water fountain in a city. Example: the 2,000+ nasoni of Rome.
All cafés in a city
List every café in a city, as points or buildings. Example: Lisbon.
Vegan and vegetarian places
Find restaurants, cafés and shops with vegan options using the diet:vegan tag. Example: Berlin.
Restaurants by cuisine
Filter restaurants by the cuisine tag. Example: every pizzeria in Naples.
Pubs in a city
Find all pubs in a city. Example: Dublin, with names, opening hours and more.
Breweries in a country
Search a whole country by ISO code. Example: every brewery in Belgium.
Supermarkets open on Sunday
Search inside opening hours with a regular expression. Example: supermarkets in Zürich that open on Sundays.
Shops & services
Shops, brands, pharmacies, banks, schools and other everyday places.
Migros supermarkets in Switzerland
List every store of a retail chain with the brand tag. Example: all Migros supermarkets in Switzerland.
All locations of a chain by Wikidata ID
Find every outlet of an international chain with brand:wikidata. Example: McDonald’s restaurants in Switzerland.
Pharmacies in a city
Find every pharmacy in a city, including dispensing information. Example: Madrid.
ATMs and banks
Find cash machines and bank branches with one regular expression. Example: Singapore.
Hospitals in a country
List every hospital in a country, mapped as points, buildings or campuses. Example: Ireland.
Schools in a city
Find all schools in a city, with their grounds. Example: Amsterdam.
Post boxes in a city
Find every post box, with collection times. Example: Edinburgh.
Wheelchair-accessible public toilets
Combine two tags to find accessible facilities. Example: wheelchair-accessible toilets in Barcelona.
Glass recycling points
Find recycling containers by the materials they accept. Example: bottle banks in Geneva.
Embassies and consulates
Find diplomatic missions with the office=diplomatic tag. Example: embassies in Bern.
Places with free Wi-Fi
Find cafés, libraries and other places that offer free internet access. Example: Barcelona.
Transport
Stations, stops, lines, roads, parking and charging.
Bus stops in a city
Find every bus stop in a city. Example: Helsinki.
Train stations in a country
List every railway station in a country. Example: Switzerland.
Metro lines of a city
Get the routes of a metro network with their geometry and colours. Example: the Paris Métro.
Tram network
Draw the tram network of a city from its route relations. Example: Zürich.
One bus line by its number
Find a single bus or trolleybus line by its ref and get its route. Example: line 31 in Zürich.
EV charging stations
Find electric vehicle chargers with their sockets and operator. Example: Oslo.
Car parks with their capacity
Find car parks and read the number of spaces. Example: Munich.
International airports worldwide
A worldwide query without area: every airport tagged as international, with IATA and ICAO codes.
Motorway network of a country
Get every motorway segment of a country with its geometry. Example: Switzerland.
Speed cameras
Find fixed speed cameras in a country. Example: the Netherlands.
Ferry routes
Draw the ferry routes of a country. Example: the Greek islands.
Cycling & walking
Cycleways, bike sharing, hiking routes and footpaths.
Cycleways and bike lanes
Map the cycling infrastructure of a city: separate cycleways plus lanes and tracks along roads. Example: Copenhagen.
Bike sharing stations
Find bike rental and sharing docks. Example: the Vélib’ stations of Paris.
Hiking routes in a region
Get marked hiking trails as route relations with their geometry. Example: around Zermatt.
Steps and stairs in a city
Find every flight of steps in a city, useful for accessibility and routing. Example: hilly Lisbon.
Ski lifts and cable cars
Draw every aerial lift of a ski area. Example: Zermatt.
Playgrounds
Find every playground in a large city. Example: Greater London.
Nature & outdoors
Peaks, lakes, rivers, parks, trees, beaches and protected areas.
Peaks higher than 4000 m
Compare numbers with an if: filter. Example: every Alpine summit above 4000 metres.
Named lakes of a country
Get lake outlines, including multipolygons, with their names. Example: Switzerland.
Rivers of a country
Draw the river network of a country from its waterway lines. Example: Slovenia.
Parks in a city
Get park outlines with their names. Example: Manhattan.
Trees by genus or species
Query the street trees of a city by genus. Example: the lime trees (Tilia) of Vienna.
Viewpoints
Find scenic viewpoints in a region. Example: around Lake Lucerne.
Campsites in a country
Find campsites with their facilities. Example: Norway.
Beaches
Find every beach on an island. Example: Mallorca.
National parks and nature reserves
Find protected areas by protection class. Example: Switzerland.
Glaciers
Draw glacier outlines in a mountain range. Example: the Bernese Alps.
Mountain huts
Find staffed and unstaffed mountain huts. Example: Switzerland.
Elevation & profiles
Heights of peaks, huts, passes and stations, the vertical rise of lifts, route profiles and sea depths.
Peaks with their height from elevation data
Add a height to every summit with elevation=1 and compare it with the ele tag of OpenStreetMap. Example: the peaks around Zermatt.
Mountain huts and their altitude
Every mountain hut in a region with its altitude, highest first, from elevation=1. Example: the canton of Valais.
Ski lifts and cable cars: vertical rise
The bottom and top height of every lift, from out geom with elevation=1. Example: the lifts of Zermatt, sorted by vertical rise.
Road passes and their height
Find the mountain passes on the main roads of a country and add their height. Example: the road passes of Switzerland, highest first.
The highest train stations
List the railway stations of a country by altitude with elevation=1, and see why stations in tunnels read too high. Example: Switzerland.
Lakes and their surface elevation
The water level of every named lake in a country from elevation=1. Example: Switzerland, from the highest mountain lakes down.
Elevation profile of a mountain railway
Draw the climb of a railway line from its route geometry and the elevation profile API. Example: the Pilatus railway, the steepest rack railway.
Elevation profile of a hiking route
Distance, ascent and descent of a hiking route from OpenStreetMap, with its elevation profile. Example: the Matterhorn Trail in Zermatt.
Offshore wind turbines and the water depth
The sea depth at every turbine of offshore wind farms, from the GEBCO grid via elevation=1. Example: the German Bight.
Buildings & places
Buildings, addresses, land use, landmarks and boundaries.
Building outlines
Get every building footprint in a small area. Example: the old town of Bern.
Tall buildings by number of floors
Find buildings with 15 or more floors using a numeric if: filter. Example: Frankfurt.
Vineyards
Draw land use areas such as vineyards. Example: the Lavaux terraces on Lake Geneva.
All addresses on a street
List every house number on a street. Example: Bahnhofstrasse, Zürich.
Places of worship
Find churches, mosques, synagogues and temples, with religion and denomination. Example: Kraków.
Castles in a region
Find castles, palaces and fortresses. Example: Rhineland-Palatinate.
Museums in a city
Find museums and galleries. Example: Berlin.
The boundary of a country
Get the outline of a country as a polygon. Example: Liechtenstein.
Municipalities of a region
Get all municipal boundaries inside a region. Example: the canton of Zug.
Cities and towns of a country
List places by size with the place tag, including population. Example: Italy.
Which areas contain a point
Reverse lookup with is_in: list the country, region and municipality of a coordinate.
Infrastructure
Power, telecoms and emergency infrastructure.
High-voltage power lines
Draw the power transmission grid of a region. Example: the Swiss Plateau.
Wind turbines
Find every wind turbine in a country. Example: Denmark.
Power plants by source
List power plants with their energy source and output. Example: Spain.
Telecom masts and towers
Find communication towers and masts. Example: the Netherlands.
Defibrillators (AEDs)
Find public defibrillators. Example: Switzerland, where volunteers mapped over 17,000.
Fire hydrants
Find fire hydrants with their type and diameter. Example: Lausanne.
Data quality
Find missing tags, fixme notes and outdated features to improve the map.
Features without a name
Find features that miss a tag, here restaurants without a name, to improve the map. Example: Prague.
Shops without opening hours
Find shops that are missing opening hours, a common mapping task. Example: Ljubljana.
Fixme notes
Find everything mappers flagged for review with a fixme tag. Example: Luxembourg.
Disused and closed features
Find features marked as disused with lifecycle prefixes. Example: Bern.
Peaks without an ele tag
Find summits that have no height in OpenStreetMap, with a reference height from the elevation model. Example: the Valais and Mont Blanc.
Advanced techniques
CSV export, counting, statistics, polygons, intersections and set operations.
Export results as CSV
Get a spreadsheet instead of JSON with [out:csv]: choose the columns, header and separator. Example: hotels in Geneva.
Count features without downloading them
Use out count to get only the number of matching elements. Example: how many trees Vienna has mapped.
Count values of a tag
Group and count with a for loop and make: how many restaurants of each cuisine. Example: Zürich.
Total length of cycleways
Compute a sum over geometries with make and length(). Example: kilometres of cycleways in Bern.
Cafés near train stations
Search around the results of another search: every café within 150 m of a station. Example: Zürich.
Search inside your own polygon
Use the poly filter to search inside any shape you draw. Example: restaurants in a part of Midtown Manhattan.
Where two streets cross
Find the intersection node of two named streets with set intersection. Example: Langstrasse and Badenerstrasse, Zürich.
Ways with their nodes (recurse down)
The classic (._;>;); out; pattern: get ways together with the nodes that give them coordinates. Example: Langstrasse, Zürich.
Shops inside a mall
Turn a mapped building into an area with map_to_area and search inside it. Example: Sihlcity, Zürich.
Regular expressions on tag values
Match several values, parts of values and any case with ~ and ,i. Example: sushi and ramen places in Hamburg.
No example matches. Try another word, or ask us for a query.
Guides
Help with errors and limits, setting up tools and libraries, and elevation data. All guides →
Errors and limits
Stuck with errors or limits on a public Overpass server? Start here.
overpass-api.de: “429 Too Many Requests”
Why the public server rejects your queries, how its slots work, and how to stay within its limits.
Overpass API errors explained
429, 504, “runtime error: Query timed out”, “out of memory”, empty results: causes and fixes, with retry code.
Overpass API alternatives
Public instances, self-hosting and hosted plans compared, and when you need which.
Tools and libraries
Point your tools at another Overpass server, step by step. Tested with the current versions.
Overpass Turbo: use another Overpass server
Where the server setting is, the exact URL format, and what to check when Turbo shows an error.
QuickOSM (QGIS): change the Overpass server
Add a server in the QuickOSM settings, or in custom_config.json on older versions, and use it in Processing.
OSMnx: custom Overpass server and node elevations
Set overpass_url, avoid a 60-second pause before every query, and add node elevations without a Google key.
osmdata (R): use another Overpass server
set_overpass_url() in the R package osmdata, with the key kept out of your scripts.
Overpass API in Python
requests, overpy and overpass: query any Overpass server from Python, with retries and GeoJSON.
Elevation
Heights and depths for points, routes and GPX tracks, and how the elevation APIs compare.
A Google Elevation API alternative
The same request and response format, a fraction of the price, and results you may store and show on any map.
Open-Elevation and Open Topo Data: limits and alternatives
What the free public elevation APIs allow, what self-hosting takes, and how to switch.
Add elevation to a GPX file
Distance, ascent and descent of a track with one curl command, and a Python script that writes the heights into the file.
Run these with your own key
Every example works unchanged on overpass.ch: full planet, updated every minute, no shared rate limits. The free plan is enough to try them all.
Map data © OpenStreetMap contributors, available under the Open Database Licence.