I want to rasterize a MultiPolygon Shapefile layer in Python and use values of one column to write to the raster. However, I cannot preclude that features of the Shapefile overlap. Is there a way to select the value from one of the features randomly if this should be the case? The code looks like this:
gdal.RasterizeLayer(mask, , layer, options = ["ATTRIBUTE=Species"])
where "Species" is the column containing the values to write to the raster. Those values describe classes and should be Integers. In case of overlapping features, it doesn't matter which one is written to the raster, as long as it is one of the feature values at that position (min, max, or random value; a mean would not be helpful).
I searched the documentation, but I found it not particularly helpful.