214

ArcGIS Desktop has the option of using basemaps from ArcGIS Online.

Does QGIS have any such options?

1
  • @spatialhast Do you know how to see from what year are the layers obtained through XYZ Tyles? Thank you Commented May 19, 2020 at 14:29

7 Answers 7

238

No plugin required

There is a core functionality XYZ Tile Server provider which was implemented with some other nice UX enhancements for tiled services (available since QGIS 2.18). This means, that there is no need for an external plugin although for an easy setup you can still use external plugins (see bottom of this post) and it offers various improvements over pure plugin based solutions.

In the browser panel, locate the Tile Server entry and right click it to add a new service.

enter image description here

Enter the URL of the service which you would like to use, replacing x, y and z parts with curly brackets substitution as can be seen below.

enter image description here

Double Click the newly created entry to add the layer to the map.

Layers added this way:

  • Load faster
  • Support reprojection
  • Support printing
  • Are cached in a powerful way
  • Are compatible with QField

Some example URLs

OpenTopoMap

https://tile.opentopomap.org/{z}/{x}/{y}.png

(See comment below for attribution)

OpenStreetMap

http://tile.openstreetmap.org/{z}/{x}/{y}.png

Google Hybrid

https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}

Google Satellite

https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}

Google Road

https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}

(Codes for other tile types from Google found here)

Bing Aerial

http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1

Configuration GUI

Since version 0.18.7 and in combination with QGIS >= 2.18.8 it's possible to use QuickMapServices as a very easy to use tool for configuring layers. Just check the "Use native renderer" checkbox (thanks @DmitryBaryshnikov)

4
  • 4
    These connection options should be added to the QGIS browser list by default. I think any GIS software should ship with basemap capabilities a click or two away.
    – Jwely
    Commented Feb 11, 2019 at 21:37
  • 7
    OpenStreetMap has been added by default. Others bear the risk that shipping these will trigger legal issues. If anyone is aware of other services which are safe to ship by default (or can provide legal advice) please contact the QGIS mailing list qgis.org/en/site/getinvolved/mailinglists.html. Commented May 14, 2019 at 7:02
  • 1
    just was told about OpenTopoMap - use: tile.opentopomap.org{z}/{x}/{y}.png and add citation like this to your maps "map data: © OpenStreetMap contributors, SRTM | map style: © OpenTopoMap (CC-BY-SA)" (thanks to @JakobMiksch)
    – Juhele
    Commented Aug 18, 2019 at 20:21
  • Thank you so much. The url for OpenTopoMap is tile.opentopomap.org{z}/{x}/{y}.png (above is missing a "/" after ".org".) Commented Apr 13, 2020 at 21:58
161

Update 2019: No plugin needed, see new answer: https://gis.stackexchange.com/a/217670/187

Update 2015: A new plugin with even more background map options is QuickMapServices

Original: Use the OpenLayers plugin to get Google Maps, Bing, OSM or Yahoo background maps.

Note that these layers are NOT SUITABLE FOR PRINTING! (see open tickets in the answer to https://gis.stackexchange.com/a/42141/187)

enter image description here

1
  • For anyone looking at QGIS in 2023+, OpenLayers is basically dead so do not waste your time with this plugin.
    – Pie
    Commented Jul 3, 2023 at 23:33
63

Another plugin to add basemaps in QGIS - QuickMapServices:

enter image description here

QGIS Python Plugins Repository: https://plugins.qgis.org/plugins/quick_map_services/

More info about plugin:

3
  • I have QGIS 2.18.3 (Mac OS X) but I don't have an option to add XYZ Tiles. you sure all 2.18.x versions have XYZ Tiles?
    – RutgerH
    Commented Jan 14, 2019 at 17:00
  • @RutgerH I'm using QGIS 3 (Mac OS X) and it has the XYZ Tiles option. Commented Mar 5, 2019 at 20:47
  • How can I remove the API Key Required watermark from openstreet basemap? Commented Mar 31, 2020 at 14:03
40

No plugin required

Credits/Author: @Klas Karlsson and an extension to @Matthias Kuhn's answer.

  1. Plugins > Python Console > Show Editor
  2. Copy&Paste the code below into a new Python file and press Run script run script
"""
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 https://qms.nextgis.com/

Licence GPL-3

Regarding the terms of use for these background maps YOU will need to verify that you
follow the individual EULA that comes with the different services,
Most likely they will restrict how you can use the data.
"""

# Sources
sources = []
sources.append(["connections-xyz","Google Maps","","","","https://mt1.google.com/vt/lyrs=m&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D","","19","0"])
sources.append(["connections-xyz","Google Satellite", "", "", "", "https://mt1.google.com/vt/lyrs=s&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Google Terrain", "", "", "", "https://mt1.google.com/vt/lyrs=t&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Google Terrain Hybrid", "", "", "", "https://mt1.google.com/vt/lyrs=p&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Google Satellite Hybrid", "", "", "", "https://mt1.google.com/vt/lyrs=y&x=%7Bx%7D&y=%7By%7D&z=%7Bz%7D", "", "19", "0"])
sources.append(["connections-xyz","Stamen Terrain", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/terrain/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/toner/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Toner Light", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/toner-lite/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Stamen Watercolor", "", "", "Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL", "http://tile.stamen.com/watercolor/%7Bz%7D/%7Bx%7D/%7By%7D.jpg", "", "18", "0"])
sources.append(["connections-xyz","Wikimedia Map", "", "", "OpenStreetMap contributors, under ODbL", "https://maps.wikimedia.org/osm-intl/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "1"])
sources.append(["connections-xyz","Wikimedia Hike Bike Map", "", "", "OpenStreetMap contributors, under ODbL", "http://tiles.wmflabs.org/hikebike/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "17", "1"])
sources.append(["connections-xyz","Esri Boundaries Places", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Esri Gray (dark)", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Dark_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
sources.append(["connections-xyz","Esri Gray (light)", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "16", "0"])
sources.append(["connections-xyz","Esri National Geographic", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "12", "0"])
sources.append(["connections-xyz","Esri Ocean", "", "", "", "https://services.arcgisonline.com/ArcGIS/rest/services/Ocean/World_Ocean_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "10", "0"])
sources.append(["connections-xyz","Esri Satellite", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
sources.append(["connections-xyz","Esri Standard", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "17", "0"])
sources.append(["connections-xyz","Esri Terrain", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "13", "0"])
sources.append(["connections-xyz","Esri Transportation", "", "", "", "https://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Transportation/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","Esri Topo World", "", "", "", "http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/%7Bz%7D/%7By%7D/%7Bx%7D", "", "20", "0"])
sources.append(["connections-xyz","OpenStreetMap Standard", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tile.openstreetmap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","OpenStreetMap H.O.T.", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tile.openstreetmap.fr/hot/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","OpenStreetMap Monochrome", "", "", "OpenStreetMap contributors, CC-BY-SA", "http://tiles.wmflabs.org/bw-mapnik/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "19", "0"])
sources.append(["connections-xyz","OpenTopoMap", "", "", "Kartendaten: © OpenStreetMap-Mitwirkende, SRTM | Kartendarstellung: © OpenTopoMap (CC-BY-SA)", "https://tile.opentopomap.org/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "17", "1"])
sources.append(["connections-xyz","Strava All", "", "", "OpenStreetMap contributors, CC-BY-SA", "https://heatmap-external-b.strava.com/tiles/all/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "15", "0"])
sources.append(["connections-xyz","Strava Run", "", "", "OpenStreetMap contributors, CC-BY-SA", "https://heatmap-external-b.strava.com/tiles/run/bluered/%7Bz%7D/%7Bx%7D/%7By%7D.png?v=19", "", "15", "0"])
sources.append(["connections-xyz","Open Weather Map Temperature", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/temp_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=1c3e4ef8e25596946ee1f3846b53218a", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Clouds", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/clouds_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=ef3c5137f6c31db50c4c6f1ce4e7e9dd", "", "19", "0"])
sources.append(["connections-xyz","Open Weather Map Wind Speed", "", "", "Map tiles by OpenWeatherMap, under CC BY-SA 4.0", "http://tile.openweathermap.org/map/wind_new/%7Bz%7D/%7Bx%7D/%7By%7D.png?APPID=f9d0069aa69438d52276ae25c1ee9893", "", "19", "0"])
sources.append(["connections-xyz","CartoDb Dark Matter", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/dark_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","CartoDb Positron", "", "", "Map tiles by CartoDB, under CC BY 3.0. Data by OpenStreetMap, under ODbL.", "http://basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D.png", "", "20", "0"])
sources.append(["connections-xyz","Bing VirtualEarth", "", "", "", "http://ecn.t3.tiles.virtualearth.net/tiles/a{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
iface.reloadConnections()

step_2

  1. After code executes a list of basemaps will appear under the XYZ Tiles in the Browser panel, see image below.

    step_3


References:

3
  • Several of these layers no longer work (e.g. wikimedia layers) or require authorization/log in for more detailed views (e.g. strava). It is easy enough to remove layers once added. Commented Mar 17, 2022 at 0:31
  • @BrianFisher, did you try them all?
    – Taras
    Commented Mar 18, 2022 at 20:48
  • 1
    I went back and tried them all. Once they loaded, I added all the layers to project with one layer zoomed to 19,191. The ones that returned error messages were: Wikimedia Hike Bike Map has repeated tiles saying "Contact [[User:TheDJ]] ..." OpenStreatMap Monochrome, and OSM H.O.T. return similar messages. The two Strava layers give a warning bar at the top saying "Access denied: authentication is now required for data access beyond zoom level 12...". All others appear to work fine. Project was set to EPSG:3857. Commented Mar 18, 2022 at 21:44
12

If you're looking to add the ESRI basemaps to QGIS, follow the steps in this blogpost using the QGIS Python console:

Copy and paste this code into the QGIS Python Console:

Adds ESRI_Imagery_World_2D service:

qgis.utils.iface.addRasterLayer("http://server.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer?f=json&pretty=true","raster")

Adds ESRI World_Street_Map service:

qgis.utils.iface.addRasterLayer("https://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer?f=json&pretty=true","raster")

Then you can save these as QGIS Layer Definition Files and add them later to any project

And here's the REST endpoint of all the ArcGIS Online basemaps you can add using the above code:

https://services.arcgisonline.com/arcgis/rest/services

5

there are several satellite base maps which can be applied to QGIS as the base map of the project and some of them are,

  1. Google Earth Base Map
  2. Bing Virtual Earth Base Map
  3. Esri Base Map

please follow the following steps,

  1. Go to Layers > Data Source Management
  2. Go to the tab XYZ Connections

enter image description here

  1. Add a New XYZ Connection

enter image description here

  1. fill the name and the web URL from either one of the following names and URLs

Google Earth Base Map : https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}

Bing Virtual Earth : http://ecn.t3.tiles.virtualearth.net/tiles/a{q}.jpeg?g=1

Esri Base Map : https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}

Google Satellite Street Map Hybrid : https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}

Open Topological Map : https://tile.opentopomap.org/{z}/{x}/{y}.png

Open Street Map : http://tile.openstreetmap.org/{z}/{x}/{y}.png

Google Street Map : https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}

Google Terrain Map : http://mt0.google.com/vt/lyrs=t&hl=en&x={x}&y={y}&z={z}

Google Terrain Street Hybrid : http://mt0.google.com/vt/lyrs=p&hl=en&x={x}&y={y}&z={z}

Google Alternative Street Map : http://mt0.google.com/vt/lyrs=r&hl=en&x={x}&y={y}&z={z}

  1. Select the preferred satellite base map from the drop down list and Add

enter image description here

Then the map will automatically update as you scroll and zoom with a working internet connection

enter image description here

1
  • 3
    A easy way to do what you wants is to install the OpenLayersPlugin. goto menu plugins and then Mangae and Install Plugins and search for OpenLayersPlugin
    – Kurt
    Commented Jan 23, 2021 at 21:52
0

How to add +50 base maps in 1 min in QGIS https://www.youtube.com/watch?time_continue=94&v=jPsf_BFCV3E

Not the answer you're looking for? Browse other questions tagged or ask your own question.