I'm attempting to rasterize a layer of a raster by using the different features inside a shapefile(In this case the different features are lines).
The problem I am running into is that RasterizeLayer does not like it when I pass it a feature rather than the layer. My code is below:
line_ds = ogr.Open(r"Lines.shp") lyr=line_ds.GetLayer() for feat in lyr: gdal.RasterizeLayer( target_ds, # raster file , #My raster band feat, #The feature in the shapeful burn_values= # my burn values )
This is a fairly standard piece of code that I have used before, but only when using whole shapefiles rather than the individual features.
Also I am trying to invert the rasterization, but RasterizeLayer doesn't seem to have an option for this, I have tired adding in:
does anyone know if there is a way to make it work?