I need to rasterize these points with setting pixel's value for each class and typically I use:
gdal_rasterize -burn 1 -where "test_class='classA'" points.shp raster.tif
and it works. At now I need to automate the procedure in Python. A simple test works fine:
import gdal raster = gdal.Open("raster.tif", gdal.GA_Update) shp = "points.shp" OPTIONS = gdal.RasterizeOptions(burnValues=) gdal.Rasterize(raster, shp, options=OPTIONS)
But when I try tu use "where" option:
OPTIONS = gdal.RasterizeOptions(burnValues=, where='"test_class"="classA"')
I'm getting an error:
ERROR 1: "classA" not recognised as an available field.
I was trying to use "where" with many combinations of characters ', ", without, and it still doesn't work.
I am open to any other solutions. I was tested rasterio library but it is very slow. I use Python 3.7 and GDAL 3.0.2.