I want to elevate a certain area of terrain by 126 meters. I've created a polygonal shapefile layer with a decimal field titled "elevation" set to 126. My plan was to rasterize the polygon using GDAL Rasterize, set the null areas to 0 using GRASS r.null, and then add the result to the original elevation raster. When I used GDAL Rasterize, the resulting raster was transparent, I assume because it was constituted completely by null values.

How can I turn my polygon into something that I can add to the original elevation raster?


Maybe you might forgot to set attribute for your polygon features (in your case 126), which GDAL Rasterize needs for processing. Example:

enter image description here

GDAL rasterize automatically set NULLs to 0 (Zero) if not set otherwise.

GRASS v.to.rast.value makes the same job well, even without a need to attribute the polygon features. Here, you set the desired value directly in the dialog. Then (as you suggest) r.null can be applied.

In both cases, resolution (and output size) needs to be set correctly (exactly as target raster).

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.