4

I'm looking to alter the height of some cells within a raster and it's been suggested that I do this by creating a polygon layer and use that as a mask to alter only the heights of cells within the polygon.

The closest problem I've found similar to this is - How to change raster cell values within a polygon using QGIS GUI? - but I'm quite new to using GIS and don't understand how to do that though, I can't seem to control the extents of the polygon and can't find how to alter the heights.

Previously, I've tried using the Raster Calculator to create separate GeoTiff files in an attempt to alter the elevations and then merge the files back into a raster, I'm not certain if that sounds more straightforward, it just seems to give me an area with nan(not a number) rather than the elevations I want to input.

Another link that might be useful - Using polygons to apply unique value to all raster cells within those polygons?

2
  • Interesting, I think there is no simple performant way to edit a cell on a raster like in a table or a form. IMO there is a need to create a tool for QGIS that is worth to carry the name raster editor or raster modeler. All the vector stuff workarounds are things as they are...
    – huckfinn
    Commented Feb 29, 2016 at 0:41
  • That's what I expected to find but not in a table format so much - since that sounds more like the manual editing that could be done in .csv files. Was mainly expecting that by defining the polygon I could then use the calculator to alter cells within such a polygon so I suppose a tool to do the same as the calculator more directly to the .asc file or at least to create an output file with just those cells altered would clearly significantly simplify the process.
    – Testchar 1
    Commented Feb 29, 2016 at 22:40

1 Answer 1

1

Found that I could create a polygon mask of desired shape using Layer>Create Layer>New Shapefile Layer... Including an integer field to be filled with "1", then converting this layer into a raster using Raster>Conversion>Rasterise, selecting your shapefile and choosing the integer field as the attribute field - I didn't alter the default pixel size given of 3000x3000 and saved in GeoTIFF format.

Using my new Raster I went to the Raster Calculator and did as described in: How to change raster cell values within a polygon using QGIS GUI? with the expression yourdem@1 - ((poltoras@1 = 1) * x ) With x being the desired reduction in height and being able to increase height within the polygon similarly. Once again saving the output in .tif

From there I converted my original topography.asc file into topography.tif using Raster>Conversion>Translate to choosing the original ASCII file and choosing the output format to be GeoTIFF. From there I merged the topography and altered elevation .tif files and then converted the resulting file back into .asc using the process described above.

Your Answer

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

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