Monday, 23 October 2017

wms - Obtaining base maps / base layers in QGIS 3.0


I'm excited to upgrade from QGIS 2.18 to 3.0. However, I rely heavily on the plugin QuickMapServices for base maps. For example, the main project I'm working on currently uses these base layers, all from QuickMapServices:



  • CartoDB Positron [no labels]


  • ESRI Gray (dark)

  • ESRI Gray (light)

  • Google Road

  • Google Terrain


QGIS 3.0 doesn't currently have this plugin or the similar OpenLayers plugin. Instead it seems we're supposed to use the "add WMS layer" function. I'm trying to replace the layers I listed above using this method, but I'm struggling. I can't figure out what URL to use to get any of the layers.


Here I found instructions for adding these layers as xyz tiles in QGIS 2.18. The URL they provided for adding a Google road layer is: https://mt1.google.com/vt/lyrs=m&x={x}&y={y}&z={z}


I tried every possible variation on this URL without success.


enter image description here


How can I get these base maps in QGIS 3.0?




Answer



I figured out how to add base maps from Google without the QuickMapServices plugin. The link I was trying to use as a WMS connection is actually for XYZ tiles. QGIS 3.0 has a great new feature, the Data Source Manager, which makes it easy to add pretty much any type of layer except XYZ tiles.


enter image description here


So at first I thought that XYZ tiles weren't available in QGIS, or that maybe they had been rolled into one of the other data types that I don't really understand.


Instead, to add XYZ tiles I had to open the Browser panel, scroll down to the bottom, and right click on XYZ Tiles > New Connection


enter image description here enter image description here


One Google layer successfully added to my project! :)




I also learned how to add a WMS layer. It's not all that hard once you have the right link, but I've found it quite challenging to find the right links.


The USGS has a lot of layers that cover the continental United States. That's not the link to paste into QGIS as the WMS URL. Follow that link and look through the different categories to get the actual links; each layer has its own link.



For example, this is the URL for a layer called "USGS Topo Base Map - Primary Tile Cache (Tiled)": https://basemap.nationalmap.gov/arcgis/services/USGSTopo/MapServer/WMSServer?request=GetCapabilities&service=WMS


And screenshots showing how to actually add that layer: enter image description here enter image description here


So now I have my Google layers back, as well as some new layers I didn't have before.


It seems like the QuickMapServices plugin was a bit of a crutch, because it allowed me to avoid ever learning how to use WMS and XYZ tiles. I'm still hoping it'll be updated for 3.0, but in the meantime I learned some new skills.




Update:


How to add any layer available through the QuickMapServices plugin to QGIS 3.0.


I just realized that the link for any layer added from the QuickMapServices plugin is available in the layer properties of that layer. So all you have to do is add that layer to a project in QGIS 2.18, open the layer properties, copy the link, and then use that link to add it as an XYZ tiled layer in 3.0.


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...