17.4. 첫 번째 알고리듬 실행과 툴박스

참고

이 강의에서 첫 번째 알고리듬을 실행하고, 첫 번째 결과를 얻을 것입니다.

앞에서 언급했듯이, 공간처리 프레임워크는 다른 응용 프로그램에서 알고리듬을 실행할 수도 있지만, 외부 소프트웨어 없이 실행할 수 있는 자체 알고리듬을 내장하고 있기도 합니다. 공간처리 프레임워크에 대해 알아보기 위해 이 자체 알고리듬 가운데 하나를 실행해보겠습니다. 먼저 폴리곤 집합의 중심점을 계산해봅시다.

먼저 이 강의에 해당하는 QGIS 프로젝트를 여십시오. 폴리곤 두 개가 있는 레이어 하나를 담고 있습니다.

../../../_images/canvas.png

Now go to the text box at the top of the toolbox. That is the search box, and if you type text in it, it will filter the list of algorithms so just those ones containing the entered text are shown. If there are algorithms that match your search but belong to a provider that is not active, an additional label will be shown in the lower part of the toolbox.

Type centroids and you should see something like this.

../../../_images/toolbox.png

The search box is a very practical way of finding the algorithm you are looking for. At the bottom of the dialog, an additional label shows that there are algorithms that match your search but belong to a provider that is not active. If you click on the link in that label, the list of algorithms will also include results from those inactive providers, which will be shown in light gray. A link to activate each inactive provider is also shown. We’ll see later how to activate other providers.

../../../_images/toolbox_providers.png

To execute an algorithm, you just have to double-click on its name in the toolbox. When you double-click on the Polygon centroids algorithm, you will see the following dialog.

../../../_images/centroids.png

All algorithms have a similar interface, which basically contains input parameters that you have to fill, and outputs that you have to select where to store. In this case, the only input we have is a vector layer with polygons.

Select the Polygons layer as input. The algorithm has a single output, which is the centroids layer. There are two options to define where a data output is saved: enter a filepath or save it to a temporary filename

In case you want to set a destination and not save the result in a temporary file, the format of the output is defined by the filename extension. To select a format, just select the corresponding file extension (or add it if you are directly typing the filepath instead). If the extension of the filepath you entered does not match any of the supported ones, a default extension (usually .dbf for tables, .tif for raster layers and .shp for vector ones) will be appended to the filepath and the file format corresponding to that extension will be used to save the layer or table.

In all the exercises in this guide, we will be saving results to a temporary file, since there is no need to save them for a later use. Feel free to save them to a permanent location if you want to.

경고

Temporary files are deleted once you close QGIS. If you create a project with an output that was saved as a temporary output, QGIS will complain when you try to open back the project later, since that output file will not exist.

Once you have configured the algorithm dialog, press Run to run the algorithm.

다음 출력물을 얻게 됩니다.

../../../_images/canvas2.png

출력물은 입력물과 동일한 CRS를 사용합니다. 공간 알고리듬은 모든 입력 레이어가 동일한 CRS를 공유한다고 가정하며 어떤 재투영 작업도 하지 않습니다. 몇몇 특별한 알고리듬(예를 들면 재투영 알고리듬)을 제외하면, 출력물도 동일한 CRS를 사용합니다. 곧 이에 대해 더 자세히 다루게 될 것입니다.

Try yourself saving it using different file formats (use, for instance, shp and geojson as extensions). Also, if you do not want the layer to be loaded in QGIS after it is generated, you can check off the checkbox that is found below the output path box.