[gdal-dev] Programmatically writing VRT files

Andrew Brooks arb at sat.dundee.ac.uk
Thu Jul 30 10:35:35 EDT 2009


Hello

I'm trying to write a program to create a VRT file that represents
raw data held in separate files by following the example in
http://www.gdal.org/gdal_vrttut.html

I put a SimpleSource or a VRTRasterBand piece of XML into xml_string
then, as per the example, I call

  GDALRasterBand *poBand = poDstDS->GetRasterBand( 1 );
  poBand->SetMetadataItem( "source_0", xml_string, "vrt_sources" );

But this gives the error:
ERROR 1: source_0 metadata item name is not recognized. Should be between source_0 and source_-1

If I use "new_vrt_sources" then I get no error, but still xml_string
is not in the output, only <VRTRasterBand dataType="UInt16" band="1"/>

I've seen the bug  https://trac.osgeo.org/gdal/ticket/3052
which suggests it is fixed in trunk and I'm using trunk.
Any other ideas?

Andrew



More information about the gdal-dev mailing list