3

I'm cutting a tiff file against a given shape, to filter the pixels inside.

I'm using rasterio to do it like this:

mask = rasterio.mask.mask(tiff, geoms, crop=True, all_touched=False)

This works but doesn't yield exactly what I want (which is: give me only the pixels that are completely inside the shape).

what i want see bigger picture

So, what all_touched=False does is, according to the docs, that it restricts the criteria from all_touched=True (fig. 1) by only including pixels that have its center inside the shape (fig. 2).

How can I select only the pixels that are completely inside the shape (like in fig. 3)?

Tony Lâmpada
  • 5,301
  • 6
  • 38
  • 50

0 Answers0