I have a geodataframe with geometry column containing Polygons and 5 fields or columns('Crop1', 'Crop2', 'Crop3', 'Crop4' and 'Crop5') as well as a raster image. There are 159 rows in the geodataframe which also means there are 159 Polygons(in the geometry column). I am supposed to "create a masked version of the raster I have where pixels falling within one of the fields are set to 1 and pixels outside the fields are set to 0". I thought about using rasterio.plot.adjust_band, but after reading it over and over, I don't think that is the solution. The geodataframe and the raster image have the same CRS.

Any ideas?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.