Basemaps! in QGIS

07 Oct 2018 ᛫ 7 min read

Different basemaps in QGIS

The header image is edited

Basemaps! Basemaps! Basemaps!

A good basemap can make or break the maps you create. Basemaps provide context. They provide character and personality. They also allow you to minimize or highlight certain aspects of your map. Thankfully, there are a lot of free basemap providers out there and it’s now very easy to incorporate them in QGIS.

Personally, I use 2 main methods to add basemaps in QGIS:

  1. Adding the basemaps as XYZ Tiles in my Browser panel using by Klas Karlsson
  2. Using the QuickMapServices plugin by NextGIS is a Python script created by Klas Karlsson that you can run in QGIS to add basemaps in your Browser Panel under an XYZ Tiles heading. You only need to run it once.

You can get the code here or see below:

This script should be run from the Python consol inside QGIS.
It adds online sources to the QGIS Browser.
Each source should contain a list with the folowing items (string type):
[sourcetype, title, authconfig, password, referer, url, username, zmax, zmin]
You can add or remove sources from the sources section of the code.
Script by Klas Karlsson
Sources from
Licence GPL-3

# Sources
sources = []
sources.append(["connections-xyz","Google Maps","","","","","","19","0"])
sources.append(["connections-xyz","Google Satellite", "", "", "", "", "", "19", "0"])
sources.append(["connections-xyz","Google Terrain", "", "", "", "", "", "19", "0"])
sources.append(["connections-xyz","Google Terrain Hybrid", "", "", "", "", "", "19", "0"])
sources.append(["connections-xyz","Google Satellite Hybrid", "", "", "", "", "", "19", "0"])
sources.append(["connections-xyz","Stamen Terrain", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner Light", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "", "", "20", "0"])
sources.append(["connections-xyz","Stamen Watercolor", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "", "", "18", "0"])
sources.append(["connections-xyz","Wikimedia Map", "", "", "OpenStreetMap contributors, under ODbL", "", "", "20", "1"])
sources.append(["connections-xyz","Wikimedia Hike Bike Map", "", "", "OpenStreetMap contributors, under ODbL", "", "", "17", "1"])
sources.append(["connections-xyz","Esri Boundaries Places", "", "", "", "", "", "20", "0"])
sources.append(["connections-xyz","Esri Gray (dark)", "", "", "", "", "", "16", "0"])
sources.append(["connections-xyz","Esri Gray (light)", "", "", "", "", "", "16", "0"])
sources.append(["connections-xyz","Esri National Geographic", "", "", "", "", "", "12", "0"])
sources.append(["connections-xyz","Esri Ocean", "", "", "", "", "", "10", "0"])
sources.append(["connections-xyz","Esri Satellite", "", "", "", "", "", "17", "0"])
sources.append(["connections-xyz","Esri Standard", "", "", "", "", "", "17", "0"])
sources.append(["connections-xyz","Esri Terrain", "", "", "", "", "", "13", "0"])
sources.append(["connections-xyz","Esri Transportation", "", "", "", "", "", "20", "0"])
sources.append(["connections-xyz","Esri Topo World", "", "", "", "", "", "20", "0"])
sources.append(["connections-xyz","OpenStreetMap Standard", "", "", "OpenStreetMap contributors, CC-BY-SA", "", "", "19", "0"])
sources.append(["connections-xyz","OpenStreetMap H.O.T.", "", "", "OpenStreetMap contributors, CC-BY-SA", "", "", "19", "0"])
sources.append(["connections-xyz","OpenStreetMap Monochrome", "", "", "OpenStreetMap contributors, CC-BY-SA", "", "", "19", "0"])
sources.append(["connections-xyz","Strava All", "", "", "OpenStreetMap contributors, CC-BY-SA", "", "", "15", "0"])
sources.append(["connections-xyz","Strava Run", "", "", "OpenStreetMap contributors, CC-BY-SA", "", "", "15", "0"])
sources.append(["connections-xyz","Open Weather Map Temperature", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Clouds", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Wind Speed", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "", "", "19", "0"])
sources.append(["connections-xyz","CartoDb Dark Matter", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "", "", "20", "0"])
sources.append(["connections-xyz","CartoDb Positron", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "", "", "20", "0"])
sources.append(["connections-xyz","Bing VirtualEarth", "", "", "", "{q}.jpeg?g=1", "", "19", "1"])

# Add sources to browser
for source in sources:
   connectionType = source[0]
   connectionName = source[1]
   QSettings().setValue("qgis/%s/%s/authcfg" % (connectionType, connectionName), source[2])
   QSettings().setValue("qgis/%s/%s/password" % (connectionType, connectionName), source[3])
   QSettings().setValue("qgis/%s/%s/referer" % (connectionType, connectionName), source[4])
   QSettings().setValue("qgis/%s/%s/url" % (connectionType, connectionName), source[5])
   QSettings().setValue("qgis/%s/%s/username" % (connectionType, connectionName), source[6])
   QSettings().setValue("qgis/%s/%s/zmax" % (connectionType, connectionName), source[7])
   QSettings().setValue("qgis/%s/%s/zmin" % (connectionType, connectionName), source[8])

# Update GUI

To run the code, open the Python console in QGIS and click Show Editor.

Python console in QGIS

Copy the code, paste it in the Editor, and Run Script.

Add and run add basemaps python script in QGIS

After the script is finished running, you should now see the available basemaps under the XYZ Tiles header in the Browser Panel.

Basemaps added to QGIS browser as XYZ tiles

You can now choose from the basemaps and add them to your map.

Aside from the usual satellite imagery (Esri Satellite, Bing VirtualEarth, Google Satellite) and street/maps (Open Street Map, Google Maps), I enjoy using CartoDb Dark Matter and CartoDb Positron.

Using CARTO darkmatter basemap with glow effect QGIS

The muted colors (black and off-white) of these basemaps make them especially suitable for visualization purposes like the one above.

QuickMapServices plugin

Another way to easily add basemaps in QGIS is by using the QuickMapServices Plugin by NextGIS. As with

After installing the plugin, you can access it via Web -> QuickMapServices or in the Plugins Toolbar. Initially, the plugin comes with just a few basemaps validated by the authors. However, you can easily add basemaps that were contributed by users by going to Web -> QuickMapServices -> Settings then going to the More services tab and clicking Get contributed pack.

QuickMapServices plugin QGIS

In fact, you can also add your own services to the plugin so that others can use it by going to

Currently, you can select from over a hundred basemaps from the QuickMapServices plugin.

QuickMapServices basemaps in QGIS

It should be noted that according to the maintainers of the plugin, the package for adding new services via the option above is planned to retire soon.

It is recommended that new services be added at In fact, I recently added the basemap from the Philippine Geoportal to the QuickMapServices catalog. You can find it under the name Philippine Geoportal Basemap.

The QuickMapServices catalog can be accessed in QGIS by via Web -> QuickMapServices -> Search QMS or the Search QMS plugin button.

Search QuickMapServices for basemaps in QGIS

This will open a window/panel where you can search from over 1500 services currently in the QuickMapServices catalog to add to your map.

Philippine Geoportal basemap in QuickMapServices in QGIS
Loaded Philippine Geoportal basemap from QuickMapServices in QGIS

That’s how you add basemaps in QGIS so the next time you feel like your map is looking dull or that it needs something extra, why not try using a new basemap.

I hope this post helped you learn something new and improve your #QGIS skills. Remember to keep honing your skills and #MakeBetterMaps. :)

comments powered by Disqus

You may also like:

Towards a spatial analysis of shooting in Philippine basketball (FOSS4G2021)

01 Oct 2021 ᛫ 1 min read

The opposite of free/libre and open source isn't commercial, it's proprietary

27 May 2021 ᛫ 2 min read

Towards a Spatial Analysis of Philippine Basketball: Applications in the UAAP MBT (Season 81) [Part 1]

02 May 2021 ᛫ 4 min read

Win and let win: On being unconventional, openness, and building communities

30 Apr 2021 ᛫ 1 min read

QGIS Styles based on HLURB Land Use Categories and Color Coding (CLUP Guidebook Vol 3, 2014)

15 Dec 2020 ᛫ 2 min read

Support BNHR

If you find my website or any of the materials I share useful, you can consider donating to the cause below.

Donate and support BNHR


[email protected]

Creative Commons License
Except when explicitly stated otherwise, this work and its contents by Ben Hur S. Pintor is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Other works (software, source code, etc.) referenced in this website are under their own respective licenses.
This site is powered by Jekyll and hosted on Github (view source)