[GIS] rasterio: ImportError: No module named tools.mask

geojsonrasterrasterioshapefile

I was trying to rasterize a geojson using rasterio mask function but there is an issue with importing the function

ImportErrorTraceback (most recent call last)
<ipython-input-1-37fb1af87d72> in <module>()
      1 import json
      2 import rasterio
----> 3 from rasterio.tools.mask import mask

ImportError: No module named tools.mask

rasterio version: '1.0a9'

Best Answer

The mask module was moved, after 0.36 if I remember correctly, so you should instead import with:

from rasterio.mask import mask
Related Question