3

In QGIS 1.8 Lisboa version in Windows 7 I want to clip a soil map (multiple polygon vectors) with a single polygon (rectangular polygon vector). The project projection is set at NAD27 UTM 12N. The soil map is Lambert Conformal Conic NAD83 and the clipping rectangular polygon is NAD27 UTM 12N.

In the project setting I have checked the box "Allow on the fly transformation. The operation: Vector > Geoprocessing Tools > Clip
input vector file (the soils)
clip layer (the rectangle)
output shalefile (new name)

Results: The layers section lists my new file BUT the file does not display and when I click on the file listed and look at the attribute table the FIELDS from the soil map are shown but there are no records in the table.

  1. What am I doing wrong?
  2. What coordinates will the new map be in? That of the soil map or that of the clipping layer?
1

4 Answers 4

7

I believe the answer is that your clipping polygon needs to be in the same projection as the data you are clipping it with. When geoprocessing, especially for accurate results, it's best to make sure all of your data is in the same projection.

3

I too went through a lot of frustration getting the QGIS clipping polygon process working. Most of the problem was CRS related I'm sure. For what it is worth, the following well-tested detailed steps might help a novice like myself, even if overkill to the more advanced QGISers. I'm using QGIS 2.14 Essen.

  1. Run QGIS and load the layer to be clipped – let’s say it is called STATE_ROADS.shp
  2. With that layer highlighted in the Layer panel, at bottom right corner click on the ESPG button and set the desired CRS. (If you have to change it, it seems that the Enable ‘on the fly’ CRS transformation box has to be checked)
  3. Create the clipping polygon layer as follows
    A. Layer menu
    B. Create Layer
    C. New Shapefile Layer
    D. Select Polygon (radio button)
    E. Set CRS of the clipping layer the same as that set for the layer to be clipped. Ignore the other boxes.
    F. OK
    G. Save as ESRI shapefile – let’s call it Ballarat_Clip.shp
    H. The clipping layer Ballarat_Clip will now be in the Layer Panel
  4. Highlight the Ballarat_Clip layer
  5. Toggle Edit ON
  6. Edit menu
  7. Add Feature
  8. Draw the clipping polygon by Left Mouse Clicks on the layer to be clipped, Right Click when done
  9. Enter an ID where prompted (say 1)
  10. Toggle Edit OFF
  11. Save changes to Ballarat_Clip
  12. Vector menu
  13. Geoprocessing Tools
  14. Clip
  15. Fill the boxes as prompted – Input layer is STATE_ROADS, Clip layer is Ballarat_Clip, let’s call Output shapefile BALLARAT_ROADS
  16. Save
  17. OK
  18. Close
  19. Turn off the Ballarat_Clip and STATE_ROADS layers and BALLARAT_ROADS are visible.
1
  • Another trap (for me anyhow) was that after defining the clip polygon you click OK. You might think all has been done, but there is more. You must now toggle editing OFF and you will be prompted to Save the changes. If you don't toggle OFF the polygon extents are not saved.
    – Bill C
    Apr 21, 2016 at 8:49
1

You need to reproject your data to be in the same CRS before performing this operation.

Try reprojecting your data in the same CRS then try again.

3
  • you and @chris henrick suggest that the two layers be in the same projection. But what is the point of checking the project setting box to "Allow on the fly transformation"?
    – Aqjo
    Apr 3, 2013 at 23:28
  • qgis when doing those kind of operations is in fact calling gdal's ogr routines. and as input it gives the original files which are in different planes, hence the empty results.
    – nickves
    Apr 3, 2013 at 23:37
  • 1
    The on the fly transformation is purely for display purposes. The clip operation is performed through a separate script which operates purely on geometries ignoring the project. This would be a bug in the script, it should warn the user when operating on files in different projection.
    – whatnick
    Aug 2, 2013 at 2:43
0

As commented above the bug is in the script performing the clip not verifying uniformity of projection. To reproject via tha GUI try the following:

  1. Set the on-the-fly reprojection to either 1 of the 2 projections
  2. Right click on the layer and select save as and select the same projection as the other layer. Reprojection dialog
  3. Save the new file and progress with the clip.
1
  • 1
    It is better to turn on-the-fly-reprojection off before doing geoprocessing across different layers. Then you see easily whether they align or not.
    – AndreJ
    Dec 14, 2013 at 15:49

Your Answer

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

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