0

I'm trying to process gdal:rasterize_over in QGIS Python console. The same problem persists - this function is rewriting the input sample raster instead of making a new one as output. I've tried (look below) to specify the name of output raster in the same folder, but to no avail:

processing.run("gdal:rasterize_over", {'INPUT':'C:/Users/user/vector_sample.gpkg|layername=water_bodies', 'INPUT_RASTER':'C:/Users/user/raster_sample.tif', 'FIELD':'band', 'ADD':False,', OUTPUT':'C:/Users/user/raster_rewrited.tif', 'EXTRA':'-at'}) 

What could you recommend me to modify? It looks like it should work perfectly, according to description of "gdal:rasterize_over" after prompting to parameters of gdal:rasterize_over in help menu.

6
  • Could you please finish the sentence: "according to..."? . Thanks. Commented Oct 2, 2023 at 8:45
  • Is your issue that the tool doesn't overwrite/replace the raster itself, but instead it overwrites the values in the existing raster? Commented Oct 2, 2023 at 9:40
  • It should create a new raster, but it overwrites the values in existing raster. P.S. Finished the end of sentence. Commented Oct 2, 2023 at 9:52
  • 1
    Possibly the documentation could be improved but no, it shouldn't create a new raster. That's why it has an input raster parameter, not an output raster parameter. If you want to create a new raster, use gdal:rasterize Commented Oct 2, 2023 at 9:58
  • If your aim is to use an existing image as a template, update some pixels, save the result into a new file, and keep the both versions, then maybe your question is a duplicate of gis.stackexchange.com/questions/416616/…. Commented Oct 2, 2023 at 11:43

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.