I have 2 layers: The first one is a point Layer (converted from SRTM) with height information. The second one is a polygon layer (shows the forest).

I want to reduce the height value - let's say about 15m if the point value is in a forest area. How can I do that?

  • 1
    Is the 'SRTM' layer actually a point layer converted from raster, or is it still a raster layer? – Simbamangu Oct 1 '12 at 9:17
  • its a point layer. I´ve converted it with surfer11 – alex serboulykzsi Oct 1 '12 at 9:42
  • 1
    @alexserboulykzsi, if the answre provided below gave you the answer you needed, please click the "checkmark" next to the answer to accept it and close teh question. Thanks. – RyanDalton Oct 1 '12 at 14:28

One way to do this is to create a new point layer that contains information about overlapping forest areas. If your point layer has an attribute 'height' and each forest polygon an attribute 'forest' which is 1 for all forest areas:

  1. Select Vector|Data Management Tools|Join attributes by location;
  2. Select the point layer as the 'target vector layer' and the polygon as the 'join vector layer';
  3. Make sure to select 'keep all records' so you keep all your points;
  4. Enter an output shapefile (like points_forestoverlap.shp) and click 'ok'; add to the TOC (layers). enter image description here

    Your new points layer will have a 'forest' attribute - forest areas will be 1 (or whatever value was in the polygon layer) and all non-overlapping points will have NULL. I have not found a way to do calculations using 'NULL' in the field calculator so you have to replace these with 0:

  5. Open the attribute table and click the 'forest' column heading to sort it;
  6. Select all the rows with NULL under 'forest';
  7. Start editing, then open the field calculator;
  8. Keep 'Only update selected features', and select 'Update existing field', and select 'forest' in the dropdown box;
  9. Enter 0 in the Expression text box and click OK - all the NULLS are replaced by 0.
  10. Open the field calculator again, deselect 'Only update selected features', and create a new field new_heights (decimal);
  11. Enter the expression "height" - (("forest" = 1) * 15) then OK; this will test if it's a forest area ("forest" =1), returning 1, and multiplying by your correction factor. enter image description here

You could also (in step 6) choose to update the existing heights field, and use the same expression.

I suspect you're doing this to correct for canopy height in a forest area? You could have a 'canopy' attribute in your forest polygon and use that to do your correction, thus you could have different canopy heights for different forest areas.

  • if you go to options > general, you can set 'Representation for null value' to whatever you want eg. '0' – PieterB Oct 1 '12 at 10:42
  • That does change the representation - but unfortunately any calculation that even looks at a null value still returns null! Just tried this substituting -9999 for NULL and doing a test ("attribute" = -9999) gives -9999 instead of 1 as result. – Simbamangu Oct 1 '12 at 11:03

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.