I have 3 contour shapefiles with 25m, 50m and 100m equidistance. Now I want to delete in the 25m-shp-file every **50m and **00m contour and in the 50m-shp-file every **00 contour. How can I show them using the field calculator of qgis?



If you have a contour value field, it should be possible to select **50m and **00m contours for later deletion using the following query with the modulo operator:

value % 50 = 0
| improve this answer | |
  • I might be wrong, but I think for this to work the contour data has to be in a database (Spatialite preferred, in my case). Unless something has changed recently. N. – nhopton Jan 29 '13 at 22:11
  • 1
    No this will work on any layer. – Nathan W Jan 29 '13 at 23:31
  • Is this a new feature? – nhopton Jan 30 '13 at 8:34
  • I'm not sure when the modulo operator was introduced @nhopton. But I think it has been around for a few versions already. – underdark Jan 30 '13 at 11:17

The simplest method is to simply create a new field based on the modulo operator, %, of the contour value.

A more complex way would be to select the 25 layer, and then select by location all the contours of the 50 layer that overlap the selection.

| improve this answer | |

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.