Web Map Services (WMS), one of the first OGC web services created, provides a method for dynamic raster generation served over the Web. They are a compromise between the flexibility of WFS and the speed of Tile services.
There are several iterations of WMS, and QGIS supports most of them. To use a WMS, you need to give QGIS the GetCapabilities URL of the service that you want to view data from.
- Find a WMS service that you want to use and copy the GetCapabilities URL. In this recipe, we can use the Geoserver demo website (http://demo.opengeo.org/geoserver/web/).
Tip
As with other web services, it's more efficient if you load your local layers and zoom to their extent first. This enables you to not waste time loading data from web services for extents outside your area of interest.
- Open the Add WMS dialog.
- Create a New connection.
- Assign a Name of your choosing and paste in the URL (http://demo.opengeo.org/geoserver/ows?service=wms&version=1.3.0&request=GetCapabilities):
Tip
On future usage of the same service, this will already be in your list of services, so you only have to add it once.
- Save your edits by clicking on OK.
- Now select the service from the drop-down list.
- Query for a list of layers using the Connect button.
- Select the layer or layers that you want to add to the map:
Tip
You can select one or more layers. If you select multiple layers, they will be merged and only appear as a single layer in the QGIS Layers list. The Layer Order tab lets you arrange the WMS layers within the combined layer. This is important when one of the layers is opaque and has 100% continuous data, allowing you to put other data on top of it visually.
- There are several other options, including image type and projection:
- For an image type, PNG is a good default as it supports lossless compression and transparency. If you don't need transparency and are okay with a little data loss, JPG can be used for smaller files, so they are faster to load.
- When picking projection, if you can use the original projection of the data (if you know it), you will get the least resampling. Otherwise, pick something that matches the other data that you plan to use in conjunction with the WMS.
Tip
Not all image types and projections are available; this depends on what the server offers. If one image type doesn't seem to work, try a different one before reporting a bad server.
- When your selection is complete, use the Add button to place the layer in the map.
- Rearrange the render order of the map by dragging layers up and down in the list.
- Pan and zoom to make fresh requests for WMS data to be loaded to the view.
When you pan and zoom the map, a request with the bounding box of the viewable extent and scale is sent to the service. The server then renders an image that matches the request and passes it back to the client (in this case, QGIS).
Some WMS services now also support tiling under the Web Map Tiling Service (WMTS) protocol. From the client's perspective, this not really different from WMS in usage. On the server side, after each request the results are cached so that if the same extent and scale is requested, the cached version can be delivered instead of creating the results from scratch. For you, the end user, this should result in faster loading if a service provides WMTS.
When configuring a WMTS, use the WMTS URL instead of the WMS URL. One example would be the Geoserver demo site's WMTS:
http://demo.opengeo.org/geoserver/gwc/service/wmts?REQUEST=GetCapabilities
Once successful, this will take you to the Tilesets tab, where you can pick which layer and projection of the available options you want to load. As the Tiles are premade or cached, you will usually not have the option to combine multiple layers at once and will need to load them one at a time:
Tip
WMS-C is an earlier version of the WMTS standard. In usage, it's pretty much the same, though the URL pattern may look more similar to the WMS.