3

In order to analyse the visibility of objects behind the orange objects, I would like to add a height of 3 meters in the area of the polygons to the Digital Elevation Model (GeoTIFF). Is there a possibility? Would there also be a possibility to have different heights at different corners?

enter image description here

2
  • Corners of the polygons or of the raster? Mar 20 at 7:04
  • If it is just those two (or a small number of) polygons, then you may find the Serval plugin useful. It allows you to select raster cells and modify their values.
    – Matt
    Mar 20 at 7:12

2 Answers 2

6

Two ways to update the target raster directly without creating a temporary raster layer:

-add

Instead of burning a new value, this adds the new value to the existing raster. Suitable for heatmaps for instance.

Usage:

gdal_rasterize -burn 3 -add polygons.json dem.tif
  • Use the same GDAL tool from the QGIS user interface "Processing-Vector conversion-Rasterize (Overwrite With Fixed Value)"

enter image description here

3
  • let's assume I have little experiece with commmand lines :) is this a python command or where do it insert that command? thank you!
    – Marek
    Mar 20 at 12:07
  • It is a command line utility and you must insert it into a Linux/Windows/Mac command line. You must have the command line tools installed into your system and if you use QGIS you should have them already. What it you operating system and how did you install QGIS?
    – user30184
    Mar 20 at 12:12
  • 1
    You can access the tool from QGIS as well (see the edited answer).
    – user30184
    Mar 20 at 12:20
4

You can use Rasterize (Vector to Raster) from GDAL to turn your polygons into a raster with a specific value where those polygons are.

Make sure your vector is in the same CRS as your raster first, then in the Rasterize tool set the vertical and horizontal resolution to the same as your raster, and choose your raster as a source for output extent. Then change "A fixed value to burn" to 3, and run the tool. You can then just use the raster calculator to add this new raster to your other raster.

If you want to different values for each object based on a certain field in the Attribute Table, you can also just choose that field under "Field to use for a burn-in value".

1
  • 2
    Almost in the same time, but your answer is more detailed.
    – Babel
    Mar 20 at 8:29

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.