How to cut DEM map file (maybe only tif) for QGIS?

Currently I loaded only TIF file. There are some additional (to tif) files like TFw, tif.aux.xml, tif.ovr - could QGIS use them somehow, or do these things here apply to them.

Tif file of mine currently contains data about spain, france and some more, but I would like to have only the spain (less than 4GB) or only the area around Barcelona.

If I simply cut the file with GIMP - would I lose information about map positioning and elevation data? Which tool is appropriate to take the tif file or the whole zip with 4 files, and cut the spanish area, so that when I open it with qgis, I will get the map positioned still in the right area? Or is it more easy to download another map with only the spanish area?


1 Answer 1


Generally, you shouldn't process GeoTIFF (or any georeferenced raster file) using an image editor that doesn't respect the georef data because in process you can (and most likely, will) lose the georeferenced data and you need to georeference the image again, which can be difficult to do with a DEM that have no clear feature to reference into.

If you want to reduce the size of your raster, you can (1) reduce the resolution when exporting the file or (2) clip your raster only to your area of interest. In my experience, it's better to have a raster layer in a projected coordinate system (learn the difference here: https://www.esri.com/arcgis-blog/products/arcgis-pro/mapping/gcs_vs_pcs/) so a 1x1 resolution means that each pixel in your raster corresponds to an area of 1x1m (with some error). This, of course, depends on your needs. Read Should I measure distance in projected or geographic coordinate system? for further information.

Then, you can clip your DEM to an extent (a bounding box, https://wiki.openstreetmap.org/wiki/Bounding_Box) or to another vector mask layer (maybe the shapefile of a country). The following documentation for QGIS can help https://docs.qgis.org/3.22/en/docs/user_manual/processing_algs/gdal/rasterextraction.html

  • 1
    Note that reprojecting raster alter the data (there are different resampling method to choose from) so even if more convenient you need to make sure it wont be a problem later...
    – J.R
    Oct 14, 2022 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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