3

I have two shape files: one for the African continent, and another with cells covering the continent. However, since the cells are an arbitrary constructions, some of cells even if they are overlapping the continent, they have some part outside of it. In other words, there are some cells which have some part within the continent and another part outside the continent. Is it possible to remove the part outside of the continent?

I tried with select by location, disjoint option, and after remove the cells using toogle editing. However, this option is not working because all my cells are touching the continent as a polygon.

Please, if you do not understand the problem, ask me to clarify. I attach a picture to make it clear.

enter image description here

[EDIT:]

The solution of Vincé and TeddyTedTed works perfectly. However, when I do it, some borders of my map of Africa disappear or they appears with a several discontinuities. Is there any solution to this? I attach a picture to make clear the problem. Additionally, When I select some of the cells (with identify features), the discontinuities appears as a part of the cell.

enter image description here

OgeiD
  • 546
  • 1
  • 4
  • 14

2 Answers2

6

In the Vector dropdown menu go to Geoprocessing Tools > Clip.

enter image description here

Use the grid layer as the input layer and Africa as the Overlay layer.

TeddyTedTed
  • 6,100
  • 1
  • 11
  • 36
6

You will need to create a new version of the layer containing only the cells within and the overlapping parts of the cells along the edges.

This can quickly be achieved by using the clip tool. Have a look at this link from the user manual. Here's also a 1:45 min short video explaining it.

Your input layer: the grid (in the below image represented by the RED circle)

Your mask layer: the outline of Africa (in the below image represented by the GREEN circle)

enter image description here *source: https://docs.qgis.org/3.22/en/docs/user_manual/processing_algs/qgis/vectoroverlay.html?highlight=clip#clip

Vincé
  • 1,416
  • 4
  • 17
  • I did an edit to my question because applying your solution I found a small problem. Is it possible to do anything? – OgeiD Dec 12 '22 at 09:29
  • Hi, please make a new question. You can link back to this question to explain what you did. It is unlikely that anyone will re-visit this old post and help you out with it. – Vincé Dec 12 '22 at 10:21
  • Ok, thank you, I will do it. I did not wanted to do that because it's a problem of the solution of the same question. – OgeiD Dec 12 '22 at 11:05