[gdal-dev] Programmatically writing VRT files

Even Rouault even.rouault at mines-paris.org
Thu Jul 30 13:38:22 EDT 2009


Le Thursday 30 July 2009 16:35:35 Andrew Brooks, vous avez écrit :
> 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

This error means that you had no existing source for that band. The metadata 
domain "vrt_sources" is used to replace an existing source, 
whereas "new_vrt_sources" should be used to add a new source.

>
> 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"/>

Perhaps your xml_string is not a valid source xml. See 
http://trac.osgeo.org/gdal/changeset/17334 for examples of tested (and 
working) use of those capabilities

>
> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list