I'm using QGIS 3.34.11 and I've georeferenced an image (that was in a custom Albers projection) that fits the OSM standard map on the back according to what i expected and well enough for my purposes. I work on the CRS EPSG:4326 and I've exported the image to a .tif (Rendered image box is checked) file keeping the CRS at EPSG:4326
Then I read it into R (4.3.3) with (2024.09.0 Build 375 RStudio) using stack() and then I aggregate it using aggregate(). Finally read it on Leaflet using leafe's addRasterRGB() but the image I get is quite misaligned with respect to the tiles below as you can see here.
I don't think the problem is with aggregate() because I've done it with other non aggregated images and the same happens. But that's as far as I've gotten.
Same thing happens to other images. I've redone the georeferencing from scratch and got to the same result.
I'm completely new (5 days) to both QGIS and R Leaflet so explain as much as you can in the answer.
raster(your_raster_here)
orterra::rast()
function? Just to check it the proper SRS is assigned. I do suspect there is a issue with CRS, as leaflet is transposing the rasters toEPSG:3857
on-the-fly (that's the default CRS used by leaflet). On the other hand you can try to project it on your own, liketerra::project(your_raster, "EPSG:3857")
.