Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
podcast
Filter by Categories
ArcGIS Pro
GDAL
GeoJson
Map
postgis
Python
QGIS
Uncategorized

Downloading Data from OpenStreetMap Using QGIS

Downloading Data from OpenStreetMap Using QGIS and QuickOSM

This guide will walk you through the process of extracting data from OpenStreetMap and converting it into a shapefile format using QGIS.

What is OpenStreetMap?

OpenStreetMap is like the Wikipedia of geographic data, allowing users to edit and contribute information freely. Unlike proprietary mapping services, OSM provides open data that can be used for various applications, from urban planning to environmental research.

OpenStreetMap interface

Getting Started with QGIS

QGIS is an open-source alternative to ArcGIS and is available across multiple operating systems. To begin, you need to download and install QGIS from the official website. Once installed, follow these steps:

  1. Open QGIS and load OpenStreetMap as a base map.
  2. Navigate to the ‘Add Data’ menu and select ‘Add Base Map’ to find OpenStreetMap.

Loading OpenStreetMap in QGIS

Installing the QuickOSM Plugin

QuickOSM is a useful plugin that simplifies the extraction of OSM data. To install it:

  1. Go to the ‘Plugins’ menu and select ‘Manage and Install Plugins.’
  2. Search for ‘QuickOSM’ and click ‘Install.’

Installing QuickOSM plugin

Using QuickOSM to Query Data

Once QuickOSM is installed, you can start extracting data:

  1. Go to the ‘Vector’ menu and select QuickOSM.
  2. In the QuickOSM dialogue, specify the keys and values you wish to query.
  3. For example, to extract buildings, type ‘building’ in the key field.

### Example Queries

1. **Download All Buildings in a Specific Area:**
plaintext
Key: building
Value: *

– **Area:** Select an area using the map canvas or by defining a bounding box. This query will download all building-related data.

2. **Download Residential Buildings:**
plaintext
Key: building
Value: residential

– **Area:** Specify the area of interest. This query fetches all residential buildings.

3. **Download Commercial Buildings:**
plaintext
Key: building
Value: commercial

– **Area:** Define the area to limit the search to commercial buildings.

4. **Download Industrial Buildings:**
plaintext
Key: building
Value: industrial

– **Area:** Use a bounding box or a predefined area. This will retrieve all industrial buildings.

5. **Download Specific Building Types:**
If you are interested in multiple specific building types such as schools and hospitals, you can use the following query:
plaintext
Key: building
Value: school

Additionally, you can run a similar query for hospitals:
plaintext
Key: building
Value: hospital

6. **Combine Multiple Values:**
To download multiple types of buildings in one go, you can use the “Advanced” feature of QuickOSM:
plaintext
Key: building
Values: residential, commercial, industrial, school, hospital

– **Area:** Again, define the area of interest. This will collect all specified building types.

7. **Download Buildings with Specific Attributes:**
If you want to download buildings that have a specific attribute, such as those with a height, you could use:
plaintext
Key: building
Value: *
Key: height
Value: *

– **Area:** Provide the corresponding area for the query.

### Tips

– You can use the `Bounding Box` option or draw a polygon on the map to define your area for the query.
– Explore the tags on OpenStreetMap for more specific building types and attributes.
– Always check the licensing of OSM data to use it appropriately in your projects.

By using these queries in conjunction with the QuickOSM plugin, you can efficiently gather the building data you need for your GIS projects.

QuickOSM dialog

Understanding Keys and Values

In OSM, data is organized into keys and values. For instance, if you’re interested in specific types of buildings, you can refine your query by adding appropriate values. You can find a comprehensive list of keys and values on the QGIS Wiki or by searching online.

OSM keys and values

Running the Query

After setting up your query:

  1. Define the area of interest; for example, use ‘canvas extent’ to limit your search to what is currently visible on your screen.
  2. Click ‘Run Query’ to execute the extraction.

Running the query in QuickOSM

Saving Your Data as a Shapefile

Once the data is extracted, it will appear as a temporary layer. To save it as a shapefile:

  1. Right-click on the layer and select ‘Make Permanent.’
  2. Choose ‘Shapefile’ as the format and select a destination on your computer.

Saving data as a shapefile

Frequently Asked Questions (FAQ)

What types of data can I extract from OpenStreetMap?

You can extract various types of data, including buildings, roads, parks, and other geographic features. The key is to understand the keys and values used in OSM data.

Is QGIS free to use?

Yes, QGIS is open-source software and is completely free to use across multiple operating systems.

Can I use OpenStreetMap data for commercial purposes?

Yes, OpenStreetMap data is open and can be used for commercial purposes, but you should always check the licensing terms to ensure compliance.

Where can I find more information about OSM features?

You can find detailed information about OSM features on the QGIS Wiki or by searching for OSM mapping features online.

About the Author
I'm Daniel O'Donohue, the voice and creator behind The MapScaping Podcast ( A podcast for the geospatial community ). With a professional background as a geospatial specialist, I've spent years harnessing the power of spatial to unravel the complexities of our world, one layer at a time.