Outdated version of the documentation. Find the latest one here.

17.7. Seleção

Nota

Nesta lição vamos a ver como os algoritmos de processamento manejam seleções em camadas vetoriais que utilizam como entrada, e como criar uma seleção através de um determinado tipo de algoritmo.

Unlike other analysis plugins in QGIS, you will not find in processing geoalgorithms any “Use only selected features” checkbox or similar. The behaviour regarding selection is set for the whole plugin and all its algorithms, and not for each algorithm execution. Algorithms follow the following simple rules when using a vector layer.

  • Se a camada tem uma seleção, só as feições selecionadas serão usadas.

  • Se não houver nenhuma seleção, todos as feições serão utilizadas.

You can test that yourself by selecting a few points in any of the layers that we used in the last chapter, and running the reprojection algorithm on them. The reprojected layer that you will obtain will contain only those points that were selected, unless there was no selection, which will cause the resulting layer to contain all points from the origin layer.

To make a selection, you can use any of the available methods and tools in QGIS. However, you can also use a geoalgorithm to do so. Algorithms for creating a selection are found in the toolbox under Vector/Selection

../../../_images/selection_algs.png

Abra o algoritmo Seleção aleatoria

../../../_images/random_selection1.png

Se desejar os valores padrões, se seleciona 10 pontos da camada atual.

../../../_images/selected1.png

You will notice that this algorithm does not produce any output, but modifies the input layer (not the layer itself, but its selection). This is an uncommon behaviour, since all the other algorithms will produce new layers and not alter the input layers.

Since the selction is not part of the data itself, but something that only exist within GIS, these selection algorithms only must be used selecting a layer that is open in QGIS, and not with the file selection option that you can find in the corresponding parameter value box.

The selection we have just made, like most of the ones created by the rest of the selection algorithms, can also be done manually from QGIS, so you might be wondering what is the point on using an algorithm for that. Although now this might not make much sense to you, we will later see how to create models and scripts. If you want to make a selection in the middle of a model (which defines a processing workflow), only a geoalgorithm algorithms can be added to a model, and other QGIS elements and operations cannot be added. That is the reason why some processing algorithms duplicate functionality that is also available in other QGIS elements.

Por hora , só recorde que as seleções podem ser feitas usando geoalgoritmos de processamiento, e que os algoritmos só utilizarão os objetos espaciais selecionados se existe uma seleção, ou todos os objetos espaciais de outra maneira.