corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
504 stars 80 forks source link

Allow rio.to_raster with a BytesIO object #668

Open SarahG-579462 opened 1 year ago

SarahG-579462 commented 1 year ago

Please consider adding support for in-memory rasterizing, rasterio supports this with MemoryFile, which could be written to a BytesIO object for easier cross-compatibility.

snowman2 commented 1 year ago

Related: https://github.com/corteva/rioxarray/discussions/204

jessjaco commented 1 year ago

This works, as recommended in the planetary computer documentation.

with io.BytesIO() as buffer:
    d.rio.to_raster(buffer, driver="COG")
    buffer.seek(0)
snowman2 commented 1 year ago

Related #309