0

I rasterized vectors using features.rasterize. Then I'd like to clip polygons from that raster but the mask.mask function requires a dataset, not an image array.

Here's how I create the raster:

rasterized = features.rasterize(shapes,
                                out_shape = (int(height),int(width)),
                                fill = 0,
                                out = None,
                                transform = rasterio.transform.from_bounds(minx, miny, maxx, maxy, width, height),
                                all_touched = True,
                                default_value = 1,
                                dtype = None)

Then I'd like to call rasterio.mask.mask on rasterized. Any tips to do this? Thanks

nside
  • 113
  • 2
  • 8

0 Answers0