Thursday, 15 March 2018

Updating/replacing raster values in one raster values from another in QGIS?



I have two rasters: one that is a land cover map (cropland data layer) and the other is a rasterized polygon representing cranberry fields that aren't represented in the land cover raster that I have. I would like to replace the values of the land cover map with the value from the cranberry raster. The values of the land cover raster under the cranberry field raster are variable (from among 8 categories).


I assume the raster calculator is used for this, but I have little experience with that tool.


Image of the cranberry field raster: enter image description here


Image of the land cover raster with cranberry raster overlaying: enter image description here



Answer



OK - after some extensive googling and a fair bit of hair ripped out, I found a solution.


Instead of using a the raster calculator, I used a shape file for the marshes, and "rasterized" them. Instead of specifying a new .tiff, I wrote over the land cover raster that I wanted to update, and boom. Done. Not sure if that is the "correct" way, but it works for what I need.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...