[Gdal-dev] VRTCreateCopy() with no filename

Frank Warmerdam warmerdam at pobox.com
Thu Feb 22 16:25:33 EST 2007


Gregory, Matthew wrote:
> I'm trying to follow a code snippet at
> http://www.gdal.org/gdal_vrttut.html, namely:
> 
> ---------
> 
> GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName( "VRT" );
> GDALDataset *poSrcDS, *poVRTDS;
> 
> poSrcDS = (GDALDataset *) GDALOpenShared( "utm.tif", GA_ReadOnly );
> poVRTDS = poDriver->CreateCopy( "", poSrcDS, FALSE, NULL, NULL, NULL );
> 
> GDALDriver *poTIFFDriver = (GDALDriver *) GDALGetDriverByName( "GTiff"
> );
> GDALDataset *poTiffDS;
> 
> poTiffDS = 
>   poTIFFDriver->CreateCopy( "wrk.tif", poVRTDS, FALSE, NULL, NULL, NULL
> );
> 
> ---------
> 
> When I try to create the VRT copy with a filename, I have no problems.
> But when I don't provide a filename (as in the sample), my computer
> hangs.  
> 
> Here is the abbreviated call stack of the hanging location:
> 
> - VSIWin32Handle::Read
> - VSIFReadL
> - GDALFindAssociatedAuxFile
> - GDALDefaultOverviews::Initialize
> - VRTDataset::Create
> - VRTCreateCopy
> 
> In gdal_misc.cpp at line 2412, it's returning a valid file pointer (fp)
> which doesn't seem right.  Can anyone straighten me out?  Obviously, the
> easy workaround is to create the temporary VRT and delete it later, but
> I wanted to make sure I wasn't missing something.

Matt,

This is a known bug in 1.4.0 and has been fixed in trunk and 1.4.x branch.
Basically there is an attempt to open a file named "aux" which is a special
device on windows and it hangs waiting for input from the device.

Sorry about that.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list