<div dir="ltr">Hi all,<div><br></div><div>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</div><div><font face="monospace"><br></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="arial, sans-serif">with open("RGB.byte.tif", "rb") as fp:</font></div><div><font face="arial, sans-serif">    data = fp.read()</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">with MemoryFile(data) as memfile:  # copies the bytes to a /vsimem/foo/bar.tif file, the exact name isn't important.</font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="arial, sans-serif">    with memfile.open() as rgb:</font></div><div><font face="arial, sans-serif">        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.</font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="arial, sans-serif"><br></font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="arial, sans-serif">    # At this point /vsimem/foo/bar.tif is closed.</font></div><div><font face="arial, sans-serif"><br></font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="arial, sans-serif"># At this point /vsimem/foo/bar.tif is deleted. I've confirmed by calling VSIReadDirRecursive().</font></div><div><font face="arial, sans-serif"><br></font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="arial, sans-serif">arr = vrt.read()</font></div></blockquote><div>           # Surprise!</div><div><br></div><div>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?</div><div><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Sean Gillies</div></div></div></div>