Làm việc với Dữ liệu WMS

Often you need reference data layers for your basemap or to display your results in the context of other datasets. Many organizations publish datasets online that can be readily used in GIS. A popular standard for publishing maps online is called WMS (Web Map Service). This is a better choice for using reference layers as you get access to rich datasets in your GIS without the hassle of downloading or styling the data.

Tổng quan về nhiệm vụ

Trong tài liệu hướng dẫn này, chúng ta sẽ mở các lớp dữ liệu về Tài nguyên khoáng sản do USGS công bố.

Nguồn dữ liệu: [MRDATA]

Các bước thực hiện

  1. Mở QGIS và vào Layer ‣ Add WMS Layer....

  1. Trong thanh Layers, bấm chuột vào New.

  1. Name your connection. This is not the name of the layer but the name of service which is offering the WMS layer. A single service usually offers multiple layers that can be added to your project. The URL that you need to access a WMS layer is called GetCapabilities. When you access a WMS server with this parameter in the URL, it returns a list of layers available along with various metadata. In this case, name the connection as MRDATA USGS and the GetCapabilities URL as http://mrdata.usgs.gov/services/ca?request=getcapabilities&service=WMS&version=1.1.1&. Click OK.
  1. Next, click on the Connect button to fetch the list of layers available. You will notice different IDs listed next to the layers. ID 0 means you get a map of all the layers. If you do not want all the layers, you can expand the list by clicking on + icon and selecting the layer of interest. Select the layer 0 for this tutorial.
  1. In the Image encoding section, you need to choose an image format. Image formats matter a great deal and which one you choose depends on your use case. Here are some pointers

    • Quality: PNG is a lossless compressed image format. JPEG is lossy compressed format. TIFF can be either. That means the quality of PNG images will be better compared to JPEG. If your main purpose is to print a map, use PNG.
    • Speed: Since PNG images are uncompressed and thus larger in size, they will take longer to load. If you are using the layer in your project as a reference layer and need to zoom/pan a lot, use JPEG.
    • Client Support: QGIS supports most of the formats, but if you are developing web applications, browsers usually do not support TIFF, so you should choose another format.
    • Loại dữ liệu: Nếu lớp dữ liệu của bạn phần đa là vector, dạng PNG sẽ là lựa chọn tốt hơn. Với dữ liệu dạng ảnh, JPEG có ưu thế.

    Trong hướng dẫn này chọn định dạng JPEG. Đổi tên :Layer name nếu muốn và bấm Add.

  1. You will see the layer loaded in the QGIS canvas. You can zoom/pan around just like any other layer. The way WMS service works is that every time you zoom/pan, it sends your viewport coordinates to the server and the server creates an image for that viewport and return it to the client. So there will be some delay before you see the image for the area after you have zoomed in. Also, since the data you see is an image, there is no way to query for attributes like in a regular vector/imagery layer.
  1. Tuy nhiên bạn có thể đọc được các siêu dữ liệu về lớp. Bấm chuột phải vào tên lớp và chọn Properties.

  1. You will notice that the Properties dialog looks different and has fewer tabs. You can go to the Metadata tab to learn more about the WMS service and the layers.
If you liked tutorials on this site and do check out spatialthoughts.com for more free resources.
comments powered by Disqus

This work is licensed under a Creative Commons Attribution 4.0 International License