I have two shapefiles: one for the African continent, and another with cells covering the continent.

I want to remove the part of the cells outside of the African continent keeping the parts that overlap the continent. I do it using "clip tool", where my input layer is the grid and my mask layer is the shapefile of Africa, using the solution given here: Removing part of the polygon outside of another shapefile but keeping the parts that overlap

However, my shapefile of Africa has the borders of the different countries. When I applied "clip", several discontinuities of the borders appears in the clipped result. Additionally, when I select some of the cells (with identify features) in the clipped results, the borders of the country (discontinuous) are also selected.

Is there any way to remove the borders of the countries in the new clipped shapefile or maintaining them in the new clipped shapefile but without discontinuities and without selecting them when I use identify features?

I attach two images to make clear the problem. The first one refers to what happens with the borders of the countries, and the second clarify what happens when I select a cell.

enter image description here

enter image description here

  • 3
    It looks like you may have some topology issues in your Africa shapefile such that the boundaries of adjoining polygons aren't coincident. I would run a v.clean on it and then validate geometry before doing the clip. If you are not familiar with the GRASS tools you might try running the Geometry Checker plugin or the Snap geometries tool and then the validate/fix geometries tool and see if that fixes things.
    – John
    Dec 12, 2022 at 11:33
  • 2
    Another option to try would be to create a temporary file for clipping where you use the dissolve tool on your mask-layer and use this for clipping. In the initial question it seemed your maskind layer was a single polygone.
    – Vincé
    Dec 12, 2022 at 12:09
  • @BERA Yes, it's a polygon shapefile with the boundaries of the African countries.
    – OgeiD
    Dec 12, 2022 at 14:26
  • @John I do not understand well your comment, what means that the boundaries of adjoining polygons are not coincident? It's a shapefile with the map of Africa, and the grid cell is a grid of cells. It should not coincide.
    – OgeiD
    Dec 12, 2022 at 14:28
  • 1
    Probably once again get back to this: gis.stackexchange.com/a/403753/88814
    – Babel
    Dec 12, 2022 at 14:33

1 Answer 1


You could try to use these clean data, if the precision is sufficient for your scale: https://www.naturalearthdata.com/downloads/10m-cultural-vectors/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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