I want to add more than one tiff file into a vrt file, Well Based on GDAL documentations it is possible to create a vrt using this code
GDALDriver *poDriver = (GDALDriver *) GDALGetDriverByName( "VRT" );
GDALDataset *poSrcDS, *poVRTDS;
poSrcDS = (GDALDataset *) GDALOpenShared( "utm.tif", GA_ReadOnly );
poVRTDS = poDriver->CreateCopy( "wrk.vrt", poSrcDS, FALSE, NULL, NULL, NULL );
GDALClose((GDALDatasetH) poVRTDS);
GDALClose((GDALDatasetH) poSrcDS);
but it only adds utm.tif. what If I want to add another set of images into this vrt file? can I use poDriver->CreateCopy again and it appends the images into the source vrt?
Answer
I'm pretty sure that adding
poSrcDS = poDriver->CreateCopy( "wrk.vrt", poSrcDS, FALSE,
APPEND_SUBDATASET=YES, NULL, NULL );
before closing the datasets should add the second dataset to the VRT as well.
Hope this helps
No comments:
Post a Comment