0

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

OgeiD
  • 546
  • 1
  • 4
  • 14
  • 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 '22 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 '22 at 12:09
  • @BERA Yes, it's a polygon shapefile with the boundaries of the African countries. – OgeiD Dec 12 '22 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 '22 at 14:28
  • @Vincé for mask-layer do you mind the African file or the grid cell? I am a bit new using GIS data, sorry. – OgeiD Dec 12 '22 at 14:30
  • 1
    Probably once again get back to this: https://gis.stackexchange.com/a/403753/88814 – Babel Dec 12 '22 at 14:33
  • @BERA That post do not solve my problem because it maintains the part of the cell outside of the borders which touch the polygon. The problem is specified here: https://gis.stackexchange.com/questions/445795/removing-part-of-the-polygon-outside-of-another-shapefile-but-keeping-the-parts This post is the first step I did to maintain just the cells I want, now I would like to remove the part of the cell outside of the polygon. – OgeiD Dec 12 '22 at 14:45

1 Answers1

0

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