2

In order to intersect a grid according to hundreds of communes, I used the graphical modeler in QGIS to automate the process.

I separated my district layer from the insee field to have as many layers as different districts: "separate the vector layer". Then I made an "intersection" of these communes in relation to a grid (mgrs grid).

But I get an error message when I launch my modeler on my intersection algorithm : 'Impossible to load the source layer for INPUT: \xxx not found Error while running Intersection'.

I think it's due to the fact that I can't save my interesected communes in a file directory but only in one file but I have several input files from my "split" algorithm.

Do you have a solution so that I have for each commune, their intersection with the grid ?

Here is a screenshot of my model (up to the error) and the parameters obtained in my intersection algorithm :

enter image description here

Parameters of the intersection algorithm : enter image description here

Screenshot showing the grid (pink) and commune layers (yellow) : enter image description here

I would have this automatically for each commune :

enter image description here

3
  • What version of QGIS are you using? Can you share a screenshot showing the grid and commune layers?
    – mapperx
    Jun 21, 2021 at 11:01
  • 1
    I'm using QGIS 3.16. I have inserted the requested screenshot in my post
    – Demonshine
    Jun 21, 2021 at 12:16
  • Added more info @Demonshire
    – mapperx
    Jun 22, 2021 at 11:29

1 Answer 1

2

Create a model in the following format.

enter image description here

Point to note, I could not add SPLIT VECTOR to the model for some reason. So I had to first split the Commune Layer using a unique attribute ie Name. The split result is saved in a folder.

With the model created (you can save it), click run to execute it. Choose to RUN AS BATCH enter image description here

Next you need to load the data, for the COMMUNE select the directory/folder containing the split layers. This will load all the communes.enter image description here Then add the GRID to the first row and click Autofill -> Fill Down. This will populate the grid layer to all the necessary field. Next for the result click the button to choose a location, type Result_ and click save. An Autofill settings will pop up .

enter image description here

Select Fill with parameter values mode and Commune as Parameter to use. Click to Load layers on completion and click Run. This should produce the results of each commune's grid. enter image description here

Adding Multiple Layers

  1. Click Run as batch process (its on the left bottom side of the screen of the model
  2. Load the Commune first. Make sure all the Split files are stored in a folder and only the split files are in that folder. Click the button on the right. Choose the Select Directory option and choose the folder where the Split files are located. It will load all the files automatically. enter image description here
  3. For the Grid, click the button to load the file for the first row, choose the grid layer. Once you have chosen the file, click auto fill. it will populate the other fields accordingly. enter image description here
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.