I have some code written in Python using PyQGIS where I am trying to overlay a raster image gridded with coordinates on to a vector shapefile map with the same coordinates. However, when overlaying the raster image, the image is shifted up and also seems larger than it should be compared to the vector layer.
Currently I am using
layer = QgsRasterLayer(filename)
Any suggestions on how to correctly overlay the raster on the vector map?