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

17.7. Selecția

Note

În această lecție vom vedea cum gestionează selecțiile algoritmii de procesare din straturile vectoriale care sunt utilizate ca intrare, și cum se poate crea o selecție, folosindu-se un anumit tip de algoritm.

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.

  • Dacă stratul are o selecție, vor fi utilizate numai entitățile selectate.

  • Dacă nu există nici o selecție, atunci vor fi utilizate toate entitățile.

Please note that you can change this behaviour by ubselecting the relevant option in the Processing ‣ Options ‣ General` menu.

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 original 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

Deschideți algoritmul de Selecție aleatoare.

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

Lăsând valorile implicite, se vor selecta 10 puncte din stratul curent.

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

Veți observa că acest algoritm nu produce nici o ieșire, dar modifică stratul de intrare (nu stratul în sine, ci selecția sa). Acesta este un comportament mai puțin frecvent, deoarece toți ceilalți algoritmi vor produce noi straturi și nu vor modifica straturile de intrare.

Since the selection is not part of the data itself, but something that only exist within QGIS, 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 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.

By now, just remember that selections can be made using processing geoalgorithms, and that algorithms will only use the selected features if a selection exists, or all features otherwise.