[Gdal-dev] Creating VRT datasets
Matt Hanson
mhanson at photon.com
Tue Sep 12 10:42:27 EDT 2006
I've found the root of my problem, but I still don't know why it's a problem.
For the CVS version, I had to turn on the /MD switch in my code (multi-thread debug). However, as near as I can tell there's no difference between the CVS and release versions in this regard. They are both compiled using /MD (assuming you compile it in Debug which is the default in the nmake.opt file). I do not have to do this with the release version (though....technically I *should* have to, the mult-thread switch should match between my code and the gdal13.dll, so I don't see why the release version would have worked, but it did I went back and tested it again).
So once I changed that switch the MSVCRT80.dll missing error went away, AND I was able to use the SetMetadataItem function, and the fix worked great. Thanks Frank!
________________________________
From: Matt Hanson
Sent: Tue 9/12/2006 9:31 AM
To: Gdal-dev at lists.maptools.org
Subject: RE: [Gdal-dev] Creating VRT datasets
Ok, well I wasn't able to solve the issue with MSVCRT80.dll "missing" in the CVS, though I did manage to get back to the stable version so I could do the work around using Setmetadata instead of Setmetadataitem.
And it caused an odd problem. Before the changes, it would create the file, but just not write the metadata. But when I change the Setmetadata line to the below, not only does not not create a file, it generates an Access Violation error as soon as it hits
Delete ds;
**********************************************************************************
GDALDataset *ds = driver->Create(filename.c_str(), ROI.width(), ROI.height(), 1, GDALType(&typeid(T)), NULL);
stringstream XML;
XML << "source_0=<SimpleSource>"
<< "<SourceFilename relativeToVRT=\"1\">" << Image.Filename() << "</SourceFilename><SourceBand>1</SourceBand>"
<< "<SrcRect xOff=\"" << ROI.x0() << "\" yOff=\"" << ROI.y0() << "\" xSize=\"" << ROI.width()
<< "\" ySize=\"" << ROI.height() << "\"/>"
<< "<DstRect xOff=\"0\" yOff=\"0\" xSize=\"" << ROI.width() << "\" ySize=\"" << ROI.height() << "\"/>"
<< "</SimpleSource>";
char* list[] = { const_cast<char*>(XML.str().c_str()), NULL };
ds->GetRasterBand(1)->SetMetadata(list, "new_vrt_sources");
delete ds;
****************************************************************
Also, I noticed that after the driver->Create call, eAccess is GA_ReadOnly - why would a new dataset that needs to be written to be Read Only?
matt
________________________________
From: fwarmerdam at gmail.com on behalf of Frank Warmerdam
Sent: Tue 9/12/2006 5:03 AM
To: Matt Hanson
Cc: Gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] Creating VRT datasets
On 9/11/06, Matt Hanson <mhanson at photon.com> wrote:
> Should I get this fix from CVS? Is last nights snapshot safe to upgrade to ?
Matt,
Yes, to the best of my knowledge the nightly cvs
should be fine.
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 | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list