How do I automatically reproject a map in GDAL (or using gdalwarp/gdaltransform etc.) to match the projection of another map? I do not want to read the projection manually and give it as input.
Basically, I would like to do something like:
gdalwarp -source map1.tif -get_projection_from map2.tif -output out.tif
Best Answer
http://www.gdal.org/gdalwarp.html says
http://www.gdal.org/gdalsrsinfo.html says it
So you can write the SRS of your other raster to a file via
and read it for gdalwarp via
You can combine this with a scripting language of your likings. You did not mention which OS you are on, so options might vary.
A simple, mostly untested, ugly proof-of-concept example Bash script without any error handling would be: