[GIS] Adding cartodb voyager basemap to QGIS and Mapinfo

basemapmapinfoqgiswmswmts

How do I add cartodb_voyager as a basemap to QGIS and Mapinfo? The map can be found here: https://leaflet-extras.github.io/leaflet-providers/preview/#filter=CartoDB.Voyager

I am using qgis v3.2 so some of the addons which would presumably add it have not been updated yet. I am using mapinfo v16 as well.

Best Answer

In the preview, you can see JavaScript code. QGIS uses Python, so we can't just use this code snippet to load the layer into QGIS. enter image description here From reading the code, we learn that this layer is a tile layer (1). Highlight and copy the service URL (2). Use this URL to load the basemap as an XYZ tile layer in QGIS. (3) Also note that the maximum zoom level should be 19.

Now, here's where it got a bit tricky. The URL from the preview JavaScript snippet doesn't work. Fortunately, I already had a few CartoDB XYZ tile layers in my browser. I compared the URL for the Voyager layer with the URL for another CartoDB layer, and found that they have different root URLs. So I took the end of the Voyager layer link, and combined it with the root URL from a functioning layer.

Here's the non-functioning link for the Voyager layer from the JavaScript in the preview:

https://cartodb-basemaps-{s}.global.ssl.fastly.net/rastertiles/voyager/{z}/{x}/{y}{r}.png

Here's a functional link for a different CartoDB layer:

http://basemaps.cartocdn.com/light_all/%7Bz%7D/%7Bx%7D/%7By%7D.png

And here's the functional link for the CartoDB Voyager layer:

http://basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png

Add basemap as XYZ Tile layer in QGIS

In Browser panel, right-click on XYZ Tiles and select "New Connection"

enter image description here

Enter layer name and service URL. Change max zoom level to 19. Click OK.

Now you have the CartoDB Voyager layer in your browser. Double-click on the layer name in the Browser panel to add it to your project.

enter image description here


Thanks to @JonathanWest for contributing this information:

According to github.com/CartoDB/basemap-styles - The structure of the URLs to call the service is the following: https://{s}.basemaps.cartocdn.com/{style}/{z}/{x}/{y}{scale}.png, where:

  • {s}: one of the available subdomains, either [a,b,c,d]
  • {z}: Zoom level. We support from 0 to 20 zoom levels in OSM tiling system.
  • {x},{y}: Tile coordinates in OSM tiling system
  • {scale}: OPTIONAL "@2x" for double resolution tiles
  • {style}: Map style, possible value is one of:
    • light_all,
    • dark_all,
    • light_nolabels,
    • light_only_labels,
    • dark_nolabels,
    • dark_only_labels,
    • rastertiles/voyager,
    • rastertiles/voyager_nolabels,
    • rastertiles/voyager_only_labels,
    • rastertiles/voyager_labels_under