I am not sure if this is possible but tried multiple ways and failed to make it work, so decided to write it here. I am generating a raster and I have it in memory as a rioxarray RasterDataset object. I want to convert it to COG and zip it, so the intended behaviour was to translate it to COG and write it to the zip without needing to write any file to filesystem (using memfiles).
The question is, is this possible? if not, does it make sense to implement it? would by happy to do if that makes sense.
with MemoryFile() as memfile:
with rasterio.open(
memfile,
driver="GTiff",
dtype=riodata[dimension].dtype,
count=1,
width=riodata.rio.width,
height=riodata.rio.height,
crs=riodata.rio.crs.to_string(),
transform=riodata.rio.transform(),
nodata=riodata[dimension].rio.nodata,
compress="LZW"
) as ds:
dataset.write(riodata.values, 1)
with MemoryFile() as cog_memfile:
cog_translate(
memfile,
cog_memfile.name,
config=dict(GDAL_NUM_THREADS="ALL_CPUS"),
in_memory=True,
dst_kwargs=cog_profiles.get("deflate"),
resampling="nearest",
)
Hi,
I am not sure if this is possible but tried multiple ways and failed to make it work, so decided to write it here. I am generating a raster and I have it in memory as a rioxarray RasterDataset object. I want to convert it to COG and zip it, so the intended behaviour was to translate it to COG and write it to the zip without needing to write any file to filesystem (using memfiles).
The question is, is this possible? if not, does it make sense to implement it? would by happy to do if that makes sense.