Le mardi 14 juin 2016 17:27:01, Julien Michel a écrit : > Dear all, > > Quick question about VRT programmatic creation. I have a list of files > corresponding to different tiles of an image and I am writing some code > to generate a mosaic VRT. For now I do it by directly writing XML to > iostream but I saw that there is actually an API to do this in GDAL. > This would be more convenient to report correctly metadata, geotransform > and wkt ... Thing is, from the doxygen of VRTRasterBand and VRTDataset, > it is not obvious if and how this can be done, and the VRT tutorial does > not help much (my use case does not correspond to any of those > presented). Does somebody know how to do this, or shall I stick to > writing my own XML stuff to iostream ?
Julien, Since GDAL 2.1, if your need is basically what gdalbuildvrt does, you could call GDALBuildVRT() : http://gdal.org/gdal__utils_8h.html#a057aaea8b0ed0476809a781ffa377ea4 Otherwise, you can study how VRTBuilder::CreateVRTNonSeparate() uses the VRTDataset/Band API : https://github.com/OSGeo/gdal/blob/trunk/gdal/apps/gdalbuildvrt_lib.cpp#L848 Even -- Spatialys - Geospatial professional services http://www.spatialys.com _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev