I am clipping a raster (.tif file) using a mask vector (.geojson) file.

with rasterio.open(url) as src: 
    out_image, out_transform = rasterio.mask.mask(src, shapes, crop=True) 

But, this rasterio.mask module is taking some time to create this NumPy array out_image.

I want to create the clipped image as fast as possible.

Is there any alternative way (for eg. from rasterio.io import MemoryFile module) to clip a raster with a mask vector layer using Rasterio (only using Rasterio and not using any other libraries) ?

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.