I have a project that references several raster files.
I've grouped and styled them in QGIS 2.18, saved and closed the project, and then changed these raster files on the disk, with a larger extent.1
When opening the QGIS project again, the rasters were still being displayed cropped to their previous extents. Examining the *.qgs file in a text editor, I see that the extent of each layer is explicitly stored.
How can I update these extents in the QGIS project to the ones of the actual rasters in the raster files on disk?
I could of course add the rasters to the project anew, group and style them again (or copy the styles from the existing references) and then remove the old references. However, I'd like to avoid this repetition of effort, if possible.
Or I could just edit the *.qgs XML in a text editor, but this seems rather error-prone.
Is there a way to do this in QGIS, with the existing references?
1 actually, re-generated them with the same file names. I had originally generated them with a Python script using gdal.Warp() with cutlineDSName=... and cropToCutline=True and later without cropToCutline.
layer = iface.activeLayer();layer.dataProvider().updateExtents()– Joseph Feb 08 '18 at 11:07updateExtents()only works for vector layers. It's callable on raster layers, but doesn't seem to have any effect there. – das-g Feb 08 '18 at 13:55updateExtents()would work for rasters because of that missing button. But glad you found a workaround at least :) – Joseph Feb 08 '18 at 14:18