11.1. Lesson: Web Mapping Services

Web Mapping Service (WMS) は,リモートサーバ上でホストされたサービスです.ウェブサイトと同じ様に, サーバへ接続することでアクセスができます. QGIS を使用すると, 既存のマップに直接 WMS をロードすることができます.

From the lesson on plugins, you will remember that it’s possible to load a new raster image from Google, for example. However, this is a once-off transaction: once you have downloaded the image, it doesn’t change. A WMS is different in that it’s a live service that will automatically refresh its view if you pan or zoom on the map.

**このレッスンの目標:**WMSを使用して制限を知ること。

11.1.1. basic Follow Along: WMSレイヤの読み込み

For this exercise, you can either use the basic map you made at the start of the course, or just start a new map and load some existing layers into it. For this example, we used a new map and loaded the original places and landuse layers and adjusted the symbology:

../../../_images/new_map.png
  • 新しいマップにこれらのレイヤを読み込みます。またはこれらのレイヤを表示のみ行いオリジナルのマップを使用します。

  • Before starting to add the WMS layer, first deactivate “on the fly” projection. This may cause the layers to no longer overlap properly, but don’t worry: we’ll fix that later.

  • WMSレイヤを追加するため、 WMS レイヤの追加 ボタンをクリックします。

    mActionAddWmsLayer

Remember how you connected to a SpatiaLite database at the beginning of the course. The landuse, places, and water layers are in that database. To use those layers, you first needed to connect to the database. Using a WMS is similar, with the exception that the layers are on a remote server.

  • To create a new connection to a WMS, click on the New button.

You’ll need a WMS address to continue. There are several free WMS servers available on the Internet. One of these is terrestris, which makes use of the OpenStreetMap dataset.

  • このWMSを利用するには、このように、今表示しているダイアログで設定します。

    ../../../_images/new_wms_connection.png
  • 名称 フィールドの値は terrestris とすべきです。

  • The value of the URL field should be http://ows.terrestris.de/osm/service.

  • Click OK. You should see the new WMS server listed:

    ../../../_images/new_connection_listed.png
  • Click Connect. In the list below, you should now see these new entries loaded:

    ../../../_images/new_wms_entries.png

    WMSサーバにホストされたレイヤがすべてあります。

  • Click once on the OSM-WMS layer. This will display its Coordinate Reference System:

    ../../../_images/osm_wms_selected.png

Since we’re not using WGS 84 for our map, let’s see all the CRSs we have to choose from.

  • Click the Change button. You will see a standard Coordinate Reference System Selector dialog.

  • We want a projected CRS, so let’s choose WGS 84 / Pseudo Mercator.

    ../../../_images/pseudo_mercator_selected.png
  • Click OK.

  • Click Add and the new layer will appear in your map as OSM-WMS.

  • In the Layers list, click and drag it to the bottom of the list.

You will notice that your layers aren’t located correctly. This is because “on the fly” projection is disabled. Let’s enable it again, but using the same projection as the OSM-WMS layer, which is WGS 84 / Pseudo Mercator.

  • “オンザフライ”再投影を有効にします。

  • In the CRS tab (Project Properties dialog), enter the value pseudo in the Filter field:

    ../../../_images/enable_projection.png
  • リストから WGS 84 / Pseudo Mercator を選択します。

  • Click OK.

  • Now right-click on one of your own layers in the Layers list and click Zoom to layer extent. You should see the Swellendam area:

    ../../../_images/wms_result.png

Note how the WMS layer’s streets and our own streets overlap. That’s a good sign!

11.1.1.1. WMSの性質と限界

By now you may have noticed that this WMS layer actually has many features in it. It has streets, rivers, nature reserves, and so on. What’s more, even though it looks like it’s made up of vectors, it seems to be a raster, but you can’t change its symbology. Why is that?

This is how a WMS works: it’s a map, similar to a normal map on paper, that you receive as an image. What usually happens is that you have vector layers, which QGIS renders as a map. But using a WMS, those vector layers are on the WMS server, which renders it as a map and sends that map to you as an image. QGIS can display this image, but can’t change its symbology, because all that is handled on the server.

This has several advantages, because you don’t need to worry about the symbology. It’s already worked out, and should be nice to look at on any competently designed WMS.

On the other hand, you can’t change the symbology if you don’t like it, and if things change on the WMS server, then they’ll change on your map as well. This is why you sometimes want to use a Web Feature Service (WFS) instead, which gives you vector layers separately, and not as part of a WMS-style map.

This will be covered in the next lesson, however. First, let’s add another WMS layer from the terrestris WMS server.

11.1.2. basic Try Yourself

  • レイヤリストOSM-WSM レイヤを隠します。

  • Add the “ZAF CGS 1M Bedrock Lithostratigraphy” WMS server at this URL: http://196.33.85.22/cgi-bin/ZAF_CGS_Bedrock_Geology/wms

  • Load the BEDROCKGEOLOGY layer into the map (use the Add WMS Layer button as before). Remember to check that it’s in the same WGS 84 / World Mercator projection as the rest of your map!

  • You might want to set its Encoding to JPEG and its Tile size option to 200 by 200, so that it loads faster:

    ../../../_images/bedrock_geology_layer.png

結果の確認

11.1.3. moderate Try Yourself

  • 背景で不要にレンダリングされるのを防ぐため、すべてのWMSレイヤを非表示にします。

  • Add the “OGC” WMS server at this URL: http://ogc.gbif.org:80/wms
  • bluemarble レイヤを追加します。

結果の確認

11.1.4. hard Try Yourself

Part of the difficulty of using WMS is finding a good (free) server.

  • Find a new WMS at spatineo.com (or elsewhere online). It must not have associated fees or restrictions, and must have coverage over the Swellendam study area.

    Remember that what you need in order to use a WMS is only its URL (and preferably some sort of description).

結果の確認

11.1.5. In Conclusion

Using a WMS, you can add inactive maps as backdrops for your existing map data.

11.1.7. What’s Next?

Now that you’ve added an inactive map as a backdrop, you’ll be glad to know that it’s also possible to add features (such as the other vector layers you added before). Adding features from remote servers is possible by using a Web Feature Service (WFS). That’s the topic of the next lesson.