I have a folder with a gdal2tiles output: 6 levels of zoom (and folders), with subfolders and .png tiles.
Is there a gdal tool to merge in a single geotiff file these .png tiles?
Thank you very much,
My solution requires a fair amount of work to get there, but this should work.
Just curious; what are you trying to accomplish? If you used gdal2tiles, the original image will be the result. You would be going form a single image, to a bunch of tiles, back to a single image... I am guessing there is a more efficient way!
gdal_merge. It should be included with most distributions of GDAL.
You'll have to generate a world file for each image first. You would use just the images from the largest scale directory (6) each subdirectory corresponds to a column of the image and each the highest number image in the subdirectory is the top row. There should be an XML file from the gdal2tiles output that has the extents. You'll have to calculate the upper left pixel coordinate of each image and pixel size (probably 1) from that.
So you might have something like:
where the lines correspond to these values from the XML file:
This will take some scripting. The world files should end in .pgw, .pngw or .wld.