Procesarea În Serie, folosind Cadrul de Procesare (QGIS3)

Cadrul de Procesare din QGIS oferă un mediu adecvat rulării algoritmilor nativi și terți de prelucrare a datelor. Acesta conține o interfață aspectuoasă de prelucrare în serie, care permite execuția cu ușurință a unui algoritm asupra mai multor straturi. Prelucrarea în serie reprezintă un instrument util care poate salva efortul manual, prin automatizarea sarcinilor repetitive.

Privire de ansamblu asupra activității

Vom decupa mai multe straturi vectoriale globale, după conturul Africii, folosind o comandă pentru seturi.

Alte competențe pe care le veți dobândi

  • Create a Filter to remove unwanted features from a layer without creating a new layer.

  • Merge multiple layers into a single Geopackage file.

Obținerea datelor

Natural Earth are mai multe straturi vectoriale globale. Descărcați următoarele straturi

Pentru comoditate, puteți descărca de mai jos un fișier geopackage care conține straturile în cauză:


Sursa datelor: [NATURALEARTH]


  1. In the QGIS Browser Panel, locate the directory where you saved your downloaded data. Expand the zip or the gpkg entry and select the ne_10m_admin_0_countries layer. Drag the layer to the canvas.

  1. You will see the layer loaded in the Layers panel. As our task is to clip the global layers to the boundary of Africa, we need to first prepare a layer containg features only from that continent. Let’s look at the attribute table to see what column can be used to query features belonging to a particular continent. Right-click the ne_10m_admin_0_countries layer and select Open Attribute Table.


Tip: You can also use the keyboard shortcut F6 to open the attribute table of the selected layer.

  1. In the Attribute Table window, as you scroll horizontally, you will see that the data contains an attribute called CONTINENT. We can use this attribute to filter features.

  1. Close the attribute table and return to the main QGIS window. Right-click the ne_10m_admin_0_countries layer and select Filter.

  1. In the Query Builder window, select the CONTINENT field and click Sample. This will populate the Values panel with the a subset of values of that attribute from features. This step is useful to get an understanding of what type of values are present in your dataset. We can see that our dataset contains a value called Africa among others.

  1. Now enter the expression in the Provider specific filter expression textbox. You can click the CONTINENT label, followed by = button and Africa label. Or you can type the following expression in the textbox. Click OK after entering the expression.

"CONTINENT" = 'Africa'
  1. You will see that the map canvas now contains only the countries from Africa. Note the filter icon next to the layer name indicating that that layer a filter applied to it. If you wanted to see and use all the features from the layer, you can click the filter icon and clear the expression. For now, we will keep the filter so we can clip other layers to Africa.

  1. We are now ready to run the batch process to clip the layers. Locate the natural earth global layers ne_10m_railroads, ne_10m_ports and ne_10m_urban_areas in the QGIS Browser panel. Hold the Ctrl key and click each layer to select them. Once selected, drag them to the canvas.

  1. Once the layers are loaded, you will notice that they are global layers and have features spanning all the countries. Now, it’s time to start our batch clip process to clip these layers to Africa. Open Processing ‣ Toolbox.

  1. Browse all available algorithms and find the Clip tool from Vector overlay ‣ Clip. You may also use the Search box to easily find the algorithm as well.

  1. Right-click the Clip algorithm and select Execute as Batch Process.

  1. In the Batch Processing dialog, the first tab is Parameters where we define our inputs. Each row in the table represents 1 processing task. Click Add row button to add a new row. As our task involves 3 layers, add 3 rows.

  1. Click the next to the first row in the Input layers column. Select Select from Open Layers.

  1. In the Multiple selection dialog, check the 3 layers that we want to clip and click OK.

  1. You will notice that the Input layer columns will be auto-populated with all layers you had selected. Next, we need to select the layer containing the boundary to clip our input layers. Click the button for the first row under Overlay layer column and select Select form Open Layers.

  1. In the Multiple selection dialog, check ne_10m_admin_0_countries and click OK.

  1. Since the clip layer is the same for all our inputs, a handy shortcut is to double-click the column header Overlay layer and the same layer will be auto-filled for all the rows.

  1. Next, we need to define our outputs. Click the buton next to the first row in the Clipped column.

  1. Browse the the directory where you want your output layers. Type the filename as clipped_ and click Save.

  1. You will see a new Autofill settings dialog pop up. Select Fill with parameter values as the Autofill mode. Select Input layer as the Parameter to use. This setting will add the input file name to the output along with the specified clipped_ filename. This is important to ensure all the output files have unique names and they do not overwrite each other.

  1. Now we are ready to start the batch procesing. Make sure to check Load layers on completion and click Run.

  1. The clip algorithm will run for each of the inputs and create output files as we have specified. Once the batch process finishes, click Close to return to QGIS.


Tip: QGIS can now run Processing tasks in the background without blocking the user interface. So if your batch process is taking long, you can close the dialog and continue to work on other tasks in QGIS while the process keeps running in the background.

  1. Back in the main QGIS window, you will see the layers added to QGIS canvas. As you will notice, all the global layers are properly clipped to the continent boundary that we had specified.

  1. We have accomplished the task of clipping multiple layers in a batch. But QGIS3 has another handy feature that will help you save and deliver the result in a more efficient way. If you wanted to deliver the clipped layers to someone, you would zip the individual files outside of QGIS. A better option is to package the output layers in a single Geopackage. In the QGIS Browser, locate the clipped output layers. You may have to click the Refresh button to see the newly added files.

  1. Hold Ctrl key and select the layers. Drag them to the canvas to load them in QGIS.

  1. In Processing Toolbox, locate the Database ‣ Package layers tool.

  1. In the Package layers dialog, click the button next to Input layers.

  1. In the Multiple selection dialog, check the clipped_ne_10m_ports, clipped_ne_10m_railroads and clipped_ne_10m_urban_areas layers. Click OK.

  1. Once the input layers are selected, click the next to Destination Geopackage and choose Save To File.

  1. Enter the output file name as clipped_layers.

  1. Click Run to start the packaging process.

  1. Once the process finishes, you will see a new geopackage file in your QGIS Browser containing all the clipped output layers. This is a single file on your computer that contains all the output layers.


If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)