[Gdal-dev] Creating VRT datasets

Matt Hanson mhanson at photon.com
Tue Sep 12 09:31:08 EDT 2006


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