[Gdal-dev] RE: VRT File Format
Matt Hanson
mhanson at photon.com
Thu Sep 21 11:39:16 EDT 2006
This is indeed interesting. I took the sample and changed the filename too. I tried gdalinfo and it works. But my code still wasn't working (corrupt XML file error). So, I made this very simple program, even switched to the C API. And it does not work. I've looked at gdalinfo.c and can't see why there would be any difference. Someone on the list emailed and suggested I avoid spaces in my filenames. I've done that too, and still doesn't work yet gdalinfo.exe does.
*******************************************************************
#include "gdal.h"
int main() {
GDALAllRegister();
const char* fname = "c:\\testimages\\tstimage";
GDALDatasetH ds = GDALOpen(fname,GA_ReadOnly);
return 0;
}
**************************************************
The exact error is:
"ERROR 1: Corrupt or empty VRT source XML document."
Which i've traced back as described before to gdalsourcerasterband.cpp:286 where it appears that while processing the XML elements it expects only XML elements, not attributes. When it hits the first attribute of VRTRasterBand it throws this error.
I'm not sure if I'm confused why my code doesn't work, or if I'm confused that the gdalinfo code does work !
Sincerely, Confused in New Hampshire
________________________________
From: Frank Warmerdam [mailto:warmerdam at pobox.com]
Sent: Wed 9/20/2006 4:56 PM
To: Matt Hanson
Cc: gdal-dev at lists.maptools.org
Subject: Re: [Gdal-dev] RE: VRT File Format
Matt Hanson wrote:
> So, can anyone verify VRT files work ? My sample VRT is as simple as the one in the documentation and GDAL is not parsing it correctly.
Matt,
I changed the SourceFilename to point to a file on my system, and then
gdalinfo on the file worked for me. This was with GDAL from CVS.
Best regards,
> Encountered another problem with the VRT files, but different then my other post - to work around that issue for now I am using absolute pathnames. But when I try to read in the VRT file below I get
> ERROR 1: Corrupt of empty VRT source XML document.
>
> Here's my VRT file:
>
> *********************************************************************************************
> <VRTDataset rasterXSize="400" rasterYSize="400">
>
> <VRTRasterBand dataType="Int16" band="1">
>
> <SimpleSource>
>
> <SourceFilename>C:\Documents and Settings\mhanson\Flux\testimages\MISI_28jun02</SourceFilename>
>
> <SourceBand>1</SourceBand>
>
> <SrcRect xOff="0" yOff="0" xSize="400" ySize="400"/>
>
> <DstRect xOff="0" yOff="0" xSize="400" ySize="400"/>
>
> </SimpleSource>
>
> </VRTRasterBand>
>
> </VRTDataset>
>
> ********************************************************************
>
>
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev
>
>
--
---------------------------------------+--------------------------------------
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 <http://osgeo.org/>
More information about the Gdal-dev
mailing list