I am desperately trying to vectorize raster files in a loop for which I came across GDAL's polygonize function (https://gdal.org/programs/gdal_polygonize.html).
However, I don't get the hang of it. To me, the input parameters are cryptic and I failed to figure out the exact commands required for application in Python.
In theory, in should be something like this:
import rioxarray
from osgeo import gdal
inputRaster = rioxarray.open_rasterio('file.tif')
gdal.Polygonize(
inputRaster,
'outputVector.shp'
)
But of course this is too simple and does not work.
My raster files has only one band:
cropRaster.shape
Out[18]: (1, 2160, 4320)
What would be the most simpel/straightforward application of GDAL polygonize in Python?