Hi all, I've written a test for rasterio and the output has me scratching my head. The gist of it: It creates a VSIMEM file copied from an ordinary GeoTIFF on my filesystem, calls GDALOpenEx on the VSIMEM file to get a handle, calls GDALAutoCreateWarpedVRT with that handle to make a warped VRT and then it deletes the VSIMEM dataset. In Python it looks like
with open("RGB.byte.tif", "rb") as fp: data = fp.read() with MemoryFile(data) as memfile: # copies the bytes to a /vsimem/foo/bar.tif file, the exact name isn't important. with memfile.open() as rgb: vrt = WarpedVRT(rgb, dst_crs="EPSG:3857") # there are two GDALDatasetH in the program now, one on /vsimem/foo/bar.tif and one on the in-memory warped VRT that references the /vsimem file. # At this point /vsimem/foo/bar.tif is closed. # At this point /vsimem/foo/bar.tif is deleted. I've confirmed by calling VSIReadDirRecursive(). arr = vrt.read() # Surprise! I'm able to read data from the warped VRT after the VSIMEM file it references has been deleted. I'm not sure how to interpret this. Was the raster data of /vsimem/foo/bar.tif cached somewhere? Did the GeoTIFF driver not actually delete the VSIMEM file? -- Sean Gillies
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/gdal-dev