3

I have shapefile cutouts (same shapefile across all images) of different GeoTIFF rasters (with different metadata and sometimes resolutions). How do I merge them into a single GeoTIFF file?

I'm well versed in Python but completely new to GIS, GDAL, and QGIS. Command line, code, and GUI based solutions are all fine.

1

From the command line, execute this command inside the directory of GeoTIFF rasters you wish to stack (like a sandwich) together:

gdal_merge.py -o your_depth_stack.tif -ps x y -separate *.tif

This will stack all images inside the directory. If you only wish to stack a certain subset replace *.tif with the desired images: image1.tif image2.tif image3.tif etc.

x and y will control the spatial resolution of your output i.e. -ps 2 2 will generate 2x2 meter pixels if your data is in UTM, for example.

Other parameters (data type, output extent, etc.) can also be controlled. See the documentation https://gdal.org/programs/gdal_merge.html for more direction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.