DEV Community

Cover image for How to Add Base Maps to QGIS
Oheneba Poku-Marboah
Oheneba Poku-Marboah

Posted on

How to Add Base Maps to QGIS

How to Add Base Maps to QGIS

Table of Contents

  • The why
  • Connect a base map source to QGIS
  • Add a base map layer
  • Some possible base map data sources
  • Summary
  • Some Map Layer Previews

Why

When you use QGIS, you may want a base map - i.e., a map of the world as a "background" to whatever spatial data you want to visualise in QGIS.

A base map can be handy for many reasons.

  • If the geometry against the backdrop of the base map seems suspect, it can easily show whether your geometries are in the wrong projection.
  • If you want to draw (digitise) a geometry at a specific location, it is several magnitudes easier to do so over a base map since you know exactly where you are drawing.
  • You see the location of other elements, which gives better spatial awareness.

Connect a base map source to QGIS

There are many ways to add layers to QGIS. In the QGIS desktop application, there is a section named browser, which is by default located on the left and in the top half of the area next to the map. There, you can see several different functions. Some of this functionality refers to ways of adding a map layer to QGIS, layers of types/sources such as Geopackage, Spatialite, PostgreSQL, and XYZ tiles, among others. For our purpose, we are going to use the XYZ tiles.
sections of QGIS

XYZ Tiles have a few other names - tiled web map, slippy map or tile map. It is a map displayed in a browser by stitching individually requested image or vector data files together to form singular totality. The X and Y refer to the coordinate system we are used to, i.e. up-down/left-right, and the Z is the 3rd dimension, i.e. depth/zoom.

To add a base map, you need to connect the source of the data to QGIS. Then, when that is done, you can add the base map as a layer to your QGIS project.
As shown in the image below - You add the source URL and then give it a name. We will use Open Street Map (https://tile.openstreetmap.org/{z}/{x}/{y}.png)

adding a source map to QGIS

Add a base map layer

Adding a map layer from the data source you just configured couldn't be easier. Click on "XYZ tiles" in the browser section of QGIS. It will display a list of all XYZ tile data sources you have configured. Click on the one you want, drag it into the map view area, and Voila.
Alternatively, drag and drop the layer into the Layers section, and it will become part of the project. A third way of achieving the same goal is to right-click the XYZ Tile source you want to use - > click "Add to project".
Now the map is available as part of your project, and you can start zooming and plotting on it.

The end result with open street map

In the GIS Stack Exchange thread that ended up helping me, there are other ways of adding base maps to your QGIS that are not described here.

  1. Through the use of a plugin
  2. Through the Python console

Check them out here- Adding base maps in QGIS - Geographic Information Systems Stack Exchange

Some possible base map data sources

A bunch of the data sources can be found in this stack overflow answer.

Some example URLs

You can find previews of these at the end of the article

This comment is from this stack overflow thread and points to the change in URL for different map types from google.

For anyone who wants to save some time while looking for specific tile types:

Layer Tile type (Google)
h roads only
m standard roadmap
p terrain
r somehow altered roadmap
s satellite only
t terrain only
y hybrid

This list is in reference to the Google data sources.

So, e.g. for Google Satellite, you would use "lyrs=s", as shown here.
https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}

Lastly, a neat little trick. At the bottom of QGIS is the coordinate input box. If you type in "world", a world map layer will be added to the current open QGIS project. It is not particularly useful at this juncture of my QGIS usage because it has zero details other than a plain visualisation of country borders.
The world base map layer that comes with QGIS

Summary

  • I demonstrated how to add a map data source to QGIS
  • How to add that data to the QGIS project or, in essence, display it.
  • We got a brief introduction on what XYZ Tiles are.
  • We saw some visual examples of map data that can be used in QGIS.
  • Lastly, you can use the links to some of the data sources and instructions on how to get even more of the different types of Google map data sources.

Some Map Layer Previews

screenshot of OpenTopoMap base layer in QGIS
OpenTopoMap
screenshot of Bing Aerial base layer in QGIS
Bing Aerial
screenshot of OpenStreetMap base layer in QGIS
OpenStreetMap
screenshot of Google Hybrid base layer in QGIS
Google Hybrid
screenshot of Google Roa base layer in QGIS
Google Road
screenshot of Google Satellite base layer in QGIS
Google Satellite

Top comments (0)