In a standalone Qgis python script I would like to get the CRS of a raster file. The idea is that I ultimately want to reproject it (probably using processing.runalg("gdalwarp ... ) but I don't want to hardcode the origin CRS in the code.
I have seen directions like this one but it all relies on the iface, which is apparently not straight-forward to use in a standaline script. Or this one, but it applies to shp and I didn't manage to adapt it to a raster layer
Is there an easier solution?