On the figure below, I have:
- a shapefile of cells of 0.5x0.5 degrees around the African continent
- a shapefile of different regions in Africa
I would like to count the number of separate regions which pass through out each cell (see the second picture for an example). In the selected cell, there are three separations (three regions).
Hence, in the final output, I would like to assign a three to that cell. I would like to do it with every cell of my grid.
My version of QGIS is 3.20.1.
Second problem: when I try to do the suggestion of @BERA
I do what @BERA suggested (look the screenshot). "polygons" is my grid cell and border_tribes is the shapefile with the regions. However, I do not obtain the results. In fact, in every cell I obtain a value of 1 for each grid cell. In the second image, I attach another screen shot of the kind of results I obtain. The number should be 3 but it appears 1.
Third problem: when I try to do @BERA suggested in the comments as a possible solution to problem 2
When I change "borders_tribes" by grid, I obtain a result of 8 in each cell. I attach a picture of what I am doing and an example of the problem.
borders_tribes
in yourPoligoni
layer. If gid, ccode or country is unique you can use any of them. That is why your calculation doesnt work