I have a number of raster datasets (with common projections, pixel sizes, and pixel alignments) that I want to mosaic into a single dataset. The source datasets overlap in a number of areas; in those areas, I want to use the newest data (which I can already determine easily on my own). What's the easiest way to do this with GDAL?
GDAL's virtual format seems ideal here; I can just throw all of the source datasets into a single .vrt
file and then use that .vrt
file in subsequent processing. I can't tell, though, how (or even whether) I can make sure that, say, source dataset "A" takes precedence over source dataset "B" in places where "A" and "B" overlap. I could also use gdal_merge.py
(or gdalwarp
) to create a new dataset, but I don't want to do that if it's not necessary, because a) it'll take a while to copy all of the data from the source datasets to the destination; and b) I'll waste a fair bit of time copying data that'll just be overwritten by later files, in the case of spatial overlaps.
What's my best path forward?
.vrt
file matter and, if so, which way? (i.e. Does the first file take precedence, or the last?) The only reference I've found to ordering of a virtual dataset is ingdalbuildvrt
's man page, which says, "If there is some amount of spatial overlapping between files, the order may depend on the order they are inserted in the VRT file, but this behaviour should not be relied on," which doesn't seem very promising.gdalbuildvrt
's documentation. That sounds like any ordering I might discover empirically could change in future GDAL releases.