1

I have a lines layer (a contour map of mean annual precipitation in Africa) that I want to clip to a polygon layer (shape of the African continent). However every time I use the clip tool (Vector-->Geoprocessing tools-->Clip), only an empty shapefile without attributes is created.

After looking at other questions in the site, I've already addressed two potential issues: (1) I've put the layers and the project in the same Coordinate Reference System (EPSG: 4326 - WGS 84) and (2) I converted the lines layer from multipart to singleparts after seeing this solved the problem for another user.

Something else to note, and I'm not sure if it even makes a difference: the lines vector layer was converted from a raster file using Raster-->Extraction-->Contour.

Below are a couple screenshots to add context:

Project overview:

enter image description here

Clip tool:

enter image description here


I found a solution by clipping the original raster file using the Africa polygon as a mask. I then converted that clipped raster file to a contour map and it solved my problem. As @ChrisW pointed out below, there was a lot of data off the coasts and I may have not waited long enough for original file to process (i.e., 40+ hours).

4
  • 1
    Are any features topologically "invalid" from either the lines or the polygon? Invalid features can yield an empty result. It's also good practice to avoid spaces in file names and paths, but that's not likely what's causing the empty output.
    – SaultDon
    Commented May 13, 2014 at 16:19
  • What are the origins of the Africa continental boundary and the rainfall contour - could you share links? Are you sure the two layers are of the same CRS?
    – Simbamangu
    Commented May 13, 2014 at 16:49
  • I just saw another question yesterday where they were getting the same result you are (blank file), but it turns out they simply weren't giving it enough time to process. What they were seeing is the container created to hold the results, but the results are not yet produced. They mentioned it took 20 minutes just for the first processing percentage increment (and visual result) to show up and something like 40 hours for the entire thing to complete. Given the size and complexity of your data, that might be the case here.
    – Chris W
    Commented May 13, 2014 at 18:00
  • @ChrisW: That could very well be the case, and you probably remember the MASSIVE data set I was working with in order to build this mean precipitation file (previous post here: gis.stackexchange.com/questions/94812/…). I found a workaround solution by clipping the raster file then converting to a contour map.
    – Eric
    Commented May 13, 2014 at 18:15

2 Answers 2

1

Your objective is to isolate the rainfall isolines, that information in your raster layer. You can clip the raster layer with the Africa vector layer. To do so go to Raster/Extraction clipper and use your vector layer as a mask. In this way you will isolate the rainfall information of Africa. Just remember that both the raster and the vector layers must be in the same CRS.

Once the rainfall values have been isolated you can extract the contours at the interval of your choice with raster/extraction/contours.

0

I assume you are trying to limit the rainfall contour lines to only display what's inside the continent borders, therefor trying to remove everything that's not within a country polygon.

Considering trying 'Intersect' rather then 'Clip'. It's in the same menu, and even the interface looks remarkable alike.

Set the same layers as you were using in your screenshot, try how that works.

If you ever need the reverse version, you can set the continent to be filled in plain white, and lay that over the contour lines. In the area within, you can then display the other layers you want over the white area of the continent.

3
  • Thanks for the suggestion, however that "Intersect" tool yields the same result (an empty shapefile).
    – Eric
    Commented May 13, 2014 at 15:56
  • 1
    why not trying to clip the raster file? take in to account that both layer must be in the same crs also. Commented May 13, 2014 at 16:46
  • @GerardoJimenez: Worked! I clipped the original raster file then converted that clipped file to a contour map. Thanks for the suggestion.
    – Eric
    Commented May 13, 2014 at 18:09

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.