중요

Translation is a community effort you can join. This page is currently translated at 48.00%.

10.2. Lesson: WFS(Web Feature Service)

WFS(Web Feature Service)는 사용자가 QGIS에 직접 불러올 수 있는 형식으로 GIS 데이터를 제공합니다. 사용자가 편집할 수 없는 맵만을 제공하는 WMS와는 달리, WFS는 피처 그 자체에 접근할 수 있도록 해줍니다.

이 강의의 목표: WFS를 사용하고 WMS와의 차이점을 이해하기.

10.2.1. basic Follow Along: WFS 레이어 불러오기

  1. 새 맵을 시작하십시오. 이 맵은 시연 용이기 때문에 저장하지 않을 겁니다.

  2. Click the dataSourceManager Open Data Source Manager button.

  3. Enable the wfs WFS / OGC API - Features tab.

  4. New 버튼을 클릭합니다.

  5. In the dialog that appears, enter the Name as nsidc.org and the URL as https://nsidc.org/cgi-bin/atlas_south?version=1.1.0.

    ../../../_images/new_wfs_connection.png
  6. OK 를 클릭하면 Server connections 에 새 연결이 나타날 것입니다.

  7. Connect 를 클릭하면 사용 가능한 레이어들의 목록이 나타납니다.

    ../../../_images/wfs_connection_layers.png
  8. Uncheck the Only request features overlapping the view extent option below the layers list, since your current map canvas may not cover our area of interest: Antarctica.

  9. Find the layer antarctica_country_border. You can use the Filter box at the top.

  10. 해당 레이어를 클릭해서 선택한 다음,

  11. Find and select also the layer south_poles_wfs. You might need to hold Ctrl.

    ../../../_images/south_poles_wfs.png
  12. Add 를 클릭하십시오.

    It may take a while to load the layers. When they are loaded, they will appear in the map, showing the outlines of Antarctica and a few points over.

    ../../../_images/antarctica_border.png

    How is this different from having a WMS layer?

  13. Select any of the layers and you’ll notice that feature selection and attribute table tools are enabled. These are vector layers.

  14. Select the south_poles_wfs layer and open its attribute table. You should see this:

    ../../../_images/poles_attribute_table.png

    포인트에 속성이 부여돼 있으므로, 라벨을 붙이는 것은 물론 심볼도 변경할 수 있습니다. 다음은 그 예입니다.

    ../../../_images/labelling_example.png

WMS 레이어와의 차이점

WFS는 레이어를 렌더링한 맵이 아니라 레이어 그 자체를 반환합니다. 데이터에 직접 접근할 수 있기 때문에, 레이어의 심볼을 변경하거나 분석 기능을 실행할 수 있습니다. 하지만 훨씬 많은 데이터를 전송해야 한다는 단점도 있습니다. 사용자가 불러오는 레이어가 복잡한 형태, 많은 속성들, 또는 많은 피처를 담고 있을 경우나 단순히 많은 레이어를 불러오는 경우 이 단점이 특히 두드러지게 됩니다. 이 때문에 WFS 레이어를 불러오는 데에는 일반적으로 긴 시간이 걸립니다.

10.2.2. moderate Follow Along: WFS 레이어 쿼리

WFS 레이어를 불러온 다음 쿼리할 수도 있지만, 대부분의 경우 불러오기 전에 쿼리하는 편이 훨씬 효율적입니다. 그렇게 하면 사용자가 원하는 피처만 요청하기 때문에 훨씬 적은 대역폭을 쓰게 되기 때문입니다.

예를 들어, 현재 사용 중인 WFS 서버 상에 countries (excluding Antarctica) 라는 레이어가 있습니다. 여기서 (아마도 antarctica_country_border 레이어와 함께) 이미 불러온 south_poles_wfs 레이어의 위치와 남아프리카 공화국의 위치를 비교해보고 싶다고 해봅시다.

두 가지 방법이 있습니다. 먼저 countries … 레이어 전체를 불러온 다음, 평소와 마찬가지로 쿼리를 작성할 수 있습니다. 하지만 전 세계의 모든 나라들의 데이터를 전송받아 남아프리카 공화국의 데이터만 이용하는 것은 대역폭을 조금 낭비하는 것 같군요. 사용자의 인터넷 연결 속도에 따라 이 데이터를 불러오는 데 몇 분이 걸릴 수도 있습니다.

두 번째는 서버에서 레이어를 불러오기도 전에 필터 역할을 하는 쿼리를 작성하는 방법입니다.

  1. Enable the WFS / OGC API Features tab in the Data Source Manager dialog

  2. Connect to the server we used before and you should see the list of available layers.

  3. Find and double-click the countries (excluding Antarctica) layer. The layer name is country_borders_excluding_antarctica. You can also select the layer and press Build query button at the bottom of the dialog:

    ../../../_images/select_country_filter.png
  4. In the dialog that appears, type the following SELECT * FROM country_borders_excluding_antarctica WHERE "Countryeng" = 'South Africa' query in the SQL Statement box.

    ../../../_images/country_sa_builder.png
  5. Press OK.

  6. The expression used will appear as the Sql value of the target layer:

    ../../../_images/country_filter_enabled.png
  7. Click Add with the layer selected as above. Only the country with the Countryeng value of South Africa will load from that layer:

    ../../../_images/antarctica_sa.png

    Did you notice the indicatorFilter icon next to the country_borders_excluding_antarctica layer? It indicates that the loaded layer is filtered and does not display in the project all of its features.

  8. 그럴 필요는 없지만 두 가지 방법을 다 해봤다면, 필터링하기 전에 모든 나라를 불러오는 것이 훨씬 느리다는 것을 알 수 있을 겁니다!

WFS의 사용성에 대해

사용자의 요구가 매우 특화되어 있을 경우, 사용자가 필요한 피처를 호스팅하고 있는 WFS를 찾기란 매우 어렵습니다. WFS가 상대적으로 희귀한 이유는 전체 피처를 표현하기 위해 전송해야 하는 데이터가 대용량이기 때문입니다. 따라서 이미지만을 전송하는 WMS에 비해, WFS를 호스팅하는 것은 가성비가 떨어집니다.

그러므로 사용자가 앞으로 보게 될 WFS는 아마도 인터넷 상에 있는 것보다는 로컬 네트워크나 혹은 사용자 자신의 컴퓨터에 있을 가능성이 가장 큽니다.

10.2.3. In Conclusion

사용자가 레이어의 속성 및 도형에 직접 접근해야 할 경우, WMS 레이어보다 WFS 레이어가 더 낫습니다. 하지만 (속도는 물론 쉽게 사용할 수 있는 공공 WFS 서버 부족이라는 문제를 일으키는) 다운로드해야 할 데이터 용량을 감안하면 언제나 WMS 대신 WFS를 사용할 수 있는 것은 아닙니다.

10.2.4. What’s Next?

Next, you’ll see how to use QGIS Server to provide OGC services.