How to Download OpenStreetMap Data into QGIS
Published

To download OpenStreetMap data into QGIS, install the QuickOSM plugin, open Vector > QuickOSM > QuickOSM…, type a key such as building in the Quick query tab, choose Canvas Extent and click Run query. For a whole country, download the .osm.pbf file from Geofabrik and drag it into QGIS instead.
Which one you want depends on two things: how big the area is, and whether you already know the OpenStreetMap tag for what you need. I ran every method below on central Kisumu, Kenya, on 23 September 2026, in QGIS 3.44.7, and timed each one.
The short answer
| Your area | Method | Measured on Kisumu |
|---|---|---|
| A town or the view you have open, and you know the tag | Method 1: QuickOSM | 5 seconds for 4,560 buildings over 6.3 km² |
| A region or a whole country | Method 2: a Geofabrik extract | 57 s to download Kenya (334 MB), 6 min 28 s to clip Kisumu out |
| A query you want to test on a map first | Method 3: Overpass Turbo, export GeoJSON | 417 buildings on screen in a few seconds |
| You don't know the tags, or you want it styled and saved in one go | Method 4: an AI agent in QGIS | 3 min 41 s for buildings, main roads, styling and a GeoPackage |
My default is QuickOSM for anything up to the size of a town, and Geofabrik the moment the area is a region. The route I'd avoid is sending a country-sized query to Overpass, and the next sections show why.
Before you start
OpenStreetMap stores everything as tags, pairs of a key and a value: building=yes, highway=primary, amenity=school. Every download method asks you for a key, a value or both, so it helps to look the tag up first on the OSM wiki Map features page. A key alone (building) returns every value of it.
You need QGIS 3.34 or newer for QuickOSM 2.5.3, the current version on the plugin repository (read 23 September 2026), and an internet connection. For the Geofabrik route, count a few hundred megabytes of disk per country.
Where the web gets this wrong
"The OpenStreetMap layer in QGIS is the data." It isn't. The OpenStreetMap entry under XYZ Tiles in the Browser panel is a set of pictures drawn from the data. You can't select a building on it, read its attributes or measure it.
The tile usage policy says it in one line: "OpenStreetMap (OSM) data is free for everyone to use. Our tile servers are not." It also forbids bulk downloading tiles, so saving the basemap to disk is not a way round it either.
"Access blocked means OpenStreetMap blocked you." The "Access blocked" message is printed on map tiles, not on data. The OSM wiki page on blocked tiles gives the most common one: "403r. Access blocked. Referer is required by tile usage policy of OpenStreetMap's volunteer-run servers".
It means the application showing the basemap did not send a Referer or User-Agent header. It has nothing to do with the data services below, which fail in other ways.
"Overpass can give me a whole country." The Overpass API wiki asks public users to stay under 10,000 queries and 1 GB a day, and points people who need large areas to the regional dumps on Geofabrik. My test asking QuickOSM for every building in Kenya died after about 32 seconds with a timeout, which Method 3 covers.
Method 1: QuickOSM, for a town or the current view
QuickOSM sends your query to an Overpass server and loads the answer as layers. It is the fastest route when the area fits on your screen.
Install QuickOSM
Plugins > Manage and Install Plugins, search QuickOSM, Install Plugin. The first time you open it, it shows a reminder that OSM data is under the ODbL and asks for the "© OpenStreetMap contributors" credit.Zoom to your area
Frame the town or neighbourhood on the canvas. I zoomed to central Kisumu, about 3 km by 2 km.Fill the Quick query tab
Vector > QuickOSM > QuickOSM…, then Quick query. Type building as the key, leave the value empty (it reads "Query on all values"), and set the extent to Canvas Extent. The other extent options are In (a place name), Around, Layer Extent and Not Spatial.Run query
ClickRun query. Kisumu came back in 5 seconds as two layers: 4,560 building polygons with 58 attribute fields, and 3 buildings mapped as points.
The Advanced section matters more than it looks. The timeout defaults to 25 seconds, which is enough for a town and not for a region. The Directory field defaults to "Save to temporary file", so the layers land in memory, marked with the scratch-layer icon in the Layers panel, and they disappear when you close QGIS without saving them.

To keep them, right-click the layer, Make Permanent…, and pick a GeoPackage path. The Kisumu buildings made a 1.5 MB file. You can also set a directory in Advanced before running, and QuickOSM writes GeoPackage (the default), GeoJSON, Shapefile or KML directly.

I did not expect how bare the tags are here. 4,453 of the 4,560 Kisumu buildings (98%) carry only building=yes. Styling "by building type" gives you one colour and 107 exceptions. The tags are only as detailed as the local mappers made them, so check the value counts before you promise a map by type.
Use it when: the area is a town or smaller and you know the key you want.
Skip it when: the area is a region or a country, or the query needs several tags combined in ways the Quick query form doesn't offer.
Method 2: A Geofabrik extract, for a region or a country
Geofabrik publishes free OpenStreetMap extracts per continent, country and, for some countries, per region. Nothing is queried: you download a file that already holds every object.
Pick the region
Browse to your country. The Kenya page on 23 September 2026 offeredkenya-latest.osm.pbf at 334 MB, kenya-latest-free.shp.zip at 939 MB and kenya-latest-free.gpkg.zip at 965 MB. The .pbf downloaded in 57 seconds here.Drag the .pbf into QGIS
QGIS opens a "Select Items to Add" dialog with five layers:points, lines, multilinestrings, multipolygons and other_relations. Buildings, land use and most areas are in multipolygons.Filter to what you need
Right-click the layer,Filter…, and write "building" IS NOT NULL. Common keys such as building, amenity and landuse are their own columns. Everything else sits in other_tags.Cut out your area and save it
A whole country is slow to draw. Clip your area out once, with the command below, and work from that file.
Don't work from the country file as it is. QGIS reads the .osm.pbf from start to end every time it draws or counts, whatever the zoom. Drawing the Kisumu view straight from the Kenya file took 19 minutes on my laptop the first time, with another job reading the same file, and counting the buildings in that view on a second pass took 2 minutes 42 seconds. Clip once with ogr2ogr, the GDAL tool that ships with QGIS:
ogr2ogr -f GPKG kisumu.gpkg kenya-latest.osm.pbf multipolygons -spat 34.745 -0.1114 34.772 -0.0926 -where "building IS NOT NULL"
That took 6 minutes 28 seconds and left a 1.3 MB GeoPackage of 4,576 buildings, which QGIS handles like any small layer. The four numbers after -spat are west, south, east and north in degrees.
The shapefile and GeoPackage zips are easier to open, with one layer per theme, but the format description lists what the free version leaves out: building height and number of levels among them. The .pbf keeps every tag.
Use it when: the area is a region or a country, or you'll query the same area many times.
Skip it when: you need one tag in one neighbourhood. Downloading 334 MB for 6 km² is the slow way.
Method 3: Overpass Turbo, for a query you want to see first
Overpass Turbo is a web page where you write an Overpass query, run it on the current map view and look at the result before you download anything. It is the place to build a query QuickOSM's form can't express.
The three lines below ask for every building in the current map view:
[out:json][timeout:25];
way["building"]({{bbox}});
out geom;
Write the query
Paste it in the editor on the left, or build one with theWizard button.Run it on your view
Zoom the map to your area and clickRun. On a zoom 17 view of central Kisumu it drew 417 buildings.Export as GeoJSON
Export, then GeoJSON, download. The same dialog offers GPX, KML and raw OSM data. Drag the .geojson file into QGIS.
This is also where the timeouts come from, because QuickOSM and Overpass Turbo talk to the same servers. The [timeout:] setting defaults to 180 seconds and [maxsize:] to 512 MB of server memory, according to the Overpass QL documentation. A query that runs past either is cut off. QuickOSM sends 25 seconds by default. When I asked it for every building in Kenya, the answer after about 32 seconds was:
Overpass error: Query timed out in "area-query" at line 5 after 30 seconds.
The public server also rations requests. Querying it directly in a quick loop to pick a town for this post, my fifth request in about 20 seconds came back 429 Too Many Requests and the sixth 504 Gateway Timeout. The wiki's advice on a 429 is to pause 30 seconds before sending the next one. Raising [timeout:] helps a query that is almost fast enough. For a country it only makes you wait longer before the same answer.
Use it when: you are writing a custom query and want to check the result on a map before loading it.
Skip it when: the area is large, or you'll repeat the download often. Use Method 2.
Method 4: One sentence to an AI agent in QGIS
We build one of these tools, AI Agent, a chat panel inside QGIS that runs the steps in the project you have open. This section is about our own tool.
It fits the reader who doesn't know the tags, or who wants the whole chain done at once: fetch, clip, style and save. In a new project, zoomed on the same view of Kisumu, I typed:
Load the buildings and main roads of central Kisumu, Kenya from OpenStreetMap, colour the buildings by footprint area, and save both layers to a GeoPackage.
It took 3 minutes 41 seconds and 39 actions. It geocoded Kisumu, queried OpenStreetMap for buildings and for roads tagged motorway to tertiary over the 6.2 km² view, clipped both to that view, and computed an area_m2 field in UTM zone 36S so the areas are in real square metres. Then it applied a five-class graduated style and wrote both layers into Kisumu central OSM.gpkg next to the project, asking once before writing the file.

The layers are ordinary QGIS layers in a GeoPackage, so they carry on into the rest of your project like the QuickOSM ones. For one tag in one view, QuickOSM's 5 seconds wins. The agent takes minutes because it also clips, adds the area field, styles and saves.
A second message shows something none of the methods above does in one go. I asked it to load the Overture Maps buildings for the same view and count the ones OpenStreetMap does not have. In 2 minutes 41 seconds it loaded 7,318 Overture buildings and matched them by ID: 4,572 come from OpenStreetMap, 2,367 from Google Open Buildings and 379 from Microsoft's machine-learning footprints.
That is 2,746 buildings, 38% of the total, that a pure OSM download of central Kisumu misses.

Use it when: the area is a town or the view you have open, and you want the data styled, clipped or compared, not only loaded.
Skip it when: you need a region or a country. It works at the scale of a town, requests over large areas time out more often, and a Geofabrik extract is the faster route there.
Credit OpenStreetMap when you publish
OpenStreetMap data is under the Open Database License. The copyright page asks for two things wherever you use it: credit OpenStreetMap, and make clear the data is under the ODbL, which a link to openstreetmap.org/copyright does. The attribution guidelines accept "© OpenStreetMap contributors" and want it next to the map or where a reader would expect credits.
A map image or a PDF is a produced work, and the credit is enough. A layer you share as data, a GeoPackage of buildings you corrected for instance, stays under the ODbL. The same page says: "If you alter or build upon our data, you may distribute the result only under the same licence." In a QGIS print layout, a text item with the credit in the corner of the map covers the first case.
What to remember
- Pick the method by area: QuickOSM for a town or the current view (5 seconds for 4,560 buildings in Kisumu), a Geofabrik
.pbffor a region or a country, Overpass Turbo to test a custom query, an AI agent when you want it clipped, styled and saved in one message. - The OpenStreetMap basemap in QGIS is a picture drawn from the data, and "Access blocked" is a message about those pictures, not about the data.
- QuickOSM results are temporary layers until you use
Make Permanent…or set a directory in Advanced. - Overpass queries fail on large areas: QuickOSM's default timeout is 25 seconds, the server rations requests with a 429, and a country belongs in a Geofabrik extract.
- OpenStreetMap coverage is uneven: in central Kisumu, Overpass returned 4,572 buildings while Overture, which adds Google and Microsoft footprints, held 7,318.
Questions people ask
How do I get OSM buildings or roads for my town?
Zoom to the town in QGIS, open Vector > QuickOSM > QuickOSM…, type building (or highway for roads) as the key, set Canvas Extent and run the query. For roads, add a value such as primary, or leave it empty to get every road class, footpaths included. Save the result with Make Permanent….
QuickOSM, Geofabrik or Overpass: which one?
QuickOSM for a town or smaller, when you know the tag. Geofabrik for a region or a country, or when you'll reuse the area. Overpass Turbo when you want to write and test a query on a map first. QuickOSM and Overpass Turbo use the same Overpass servers, so they share the same size limits.
Why does my Overpass query time out or say access blocked?
A timeout means the query ran past its [timeout:] (25 seconds in QuickOSM, 180 by default on Overpass) or its memory limit, so shrink the area or switch to a Geofabrik extract. A 429 Too Many Requests means you sent too many in a short time. Wait 30 seconds. "Access blocked" is printed on basemap tiles, not on Overpass data, and comes from the tile server's Referer and User-Agent rules.
How do I save the temporary layer QuickOSM creates?
Right-click the layer in the Layers panel, Make Permanent…, choose GeoPackage and a file path. To skip the step next time, set a Directory in the Advanced section of QuickOSM before you run the query, and it writes the file directly.
What does the ODbL licence require when I publish a map?
Credit OpenStreetMap, for example "© OpenStreetMap contributors", next to the map, and make clear the data is under the ODbL, usually with a link to openstreetmap.org/copyright. If you share the data itself, changed or not, it has to stay under the ODbL.
Is OSM building coverage complete?
Not everywhere. A 2023 study in Nature Communications estimated the average completeness of OSM buildings at 24% per urban centre worldwide, with 71% in Europe and Central Asia and 9% in South Asia. In central Kisumu, 38% of the buildings Overture holds are not in OSM.
Compare against other sources before you rely on counts, or detect the missing ones from imagery, as in detecting building footprints in QGIS. What a building footprint is covers the difference between the datasets.
Once the data is in, the AI Agent guide shows what else one message can do with it. If your next layer is imagery rather than vectors, downloading Sentinel-2 in QGIS and georeferencing a scanned map are the two companion tutorials, and adding a basemap covers the picture layer this post starts from.
, install the QuickOSM plugin, open 

