Re: MemoryFile loses Profile information


vincent.sarago@...
 

I can confirm that writing a Jpeg2000 from memory losses the geo information

with rasterio.open("B01.jp2") as src:
    with MemoryFile() as memfile:
        with memfile.open(**src.profile) as mem:
            print(mem.meta)
            mem.write(src.read())
 
        with open("test.jp2", "wb") as f:
            f.write(memfile.read())
 
with rasterio.open("test.jp2") as src:
    print(src.meta)
 
# {'driver': 'JP2OpenJPEG', 'dtype': 'uint16', 'nodata': None, 'width': 1830, 'height': 1830, 'count': 1, 'crs': CRS.from_epsg(32707), 'transform': Affine(60.0, 0.0, 600000.0, 0.0, -60.0, 7100020.0)}
# {'driver': 'JP2OpenJPEG', 'dtype': 'uint16', 'nodata': None, 'width': 1830, 'height': 1830, 'count': 1, 'crs': None, 'transform': Affine(1.0, 0.0, 0.0, 0.0, 1.0, 0.0)}
    

Join main@rasterio.groups.io to automatically receive all group messages.