2

I am using QGIS 2.2.0 and want to clip a line layer (roads) so that only those inside a polygon are shown. When I do this using Vector->Geoprocessing Tools->Clip I only get an empty shapefile as an output. I have tried transforming the original road shape file from multipart to singlepart before clipping and still have the same problem.

I've included a screenshot of what I am trying to do.

Does anyone have an idea of what is going wrong or something to do differently?

Clipping Line by Polygon

  • 3
    Are you sure that road layer and polygon layer have the same CRS? If you turn On-the-fly-reprojection OFF, do they still align? – AndreJ Apr 17 '14 at 14:30
  • @AndreJoost you're right they don't align, but when I try to use the same CRS as the polygon layer (a user generated one) I have the problem that the two layers don't match anyway. Instead I used WGS 84 for the road layer to get them to display on the polygon. Maybe I should address this problem first... – Katie Apr 19 '14 at 8:04
  • Surely. If they don't align without on-the-fly-reprojection, clipping won't work. – AndreJ Apr 19 '14 at 9:44
  • @AndreJoost, I'm new to QGIS so please forgive me if my questions are obvious, but is there a way to to get the two layers to align? – Katie Apr 22 '14 at 13:18
  • What CRS do your layers have? What extent is reported under properties, metadata tab? What is your project CRS? – AndreJ Apr 22 '14 at 15:05
5

For the clipping of two layers, it is mandatory that both are stored to disk in the same CRS.

What you can do is:

  1. Save the polygon layer with Rightclick -> Save As ... choose a new filename and WGS84 as CRS
  2. Add the new shapefile to the canvas
  3. remove the old polygon layer
  4. clip the roads to the polygons

You can obviously do it the other way round too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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