0

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 georeferenced image as seen on QGIS

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.

misaligned image as shown in R Leaflet

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.

4
  • Would you mind to put output of raster(your_raster_here) or terra::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 to EPSG: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, like terra::project(your_raster, "EPSG:3857"). Commented Nov 5 at 18:17
  • I'm not seeing an issue (and it's probably my problem). The symbols and polygon is showing up relative to what I think is the basemap fine in both images; the images are using different coordinate systems, so the overal shapes look different, but relatively, positions look fine to me. 3857 will be more stretched north-south relative to the Albers CRS.
    – mkennedy
    Commented Nov 6 at 1:15
  • Thank you for your comments! I’m sorry I’m this late but I thought I would get notice on my email about the responses. I’ve looked the raster extent and this is the output class : Extent xmin : -93.47375 xmax : -70.32889 ymin : 28.86303 ymax : 47.63772 Whereas the coordinates on qgis are -93,44047737 -69,99378627 28,79577902 47,64277651 I think the issue might be that the image is warped/curved so there’s a lot of transparent data in the corners, could it be that? I’ve tried assigning a new extent to the image on R also on R I Have tried resampling, but none of those things worked Commented Nov 7 at 8:54
  • This is how the image looks on QGIS (project CRS: EPSG:4326) link can you give me any ideas how to solve this? Cropping the image being a last resort if possible. Thank you!!!!! Commented Nov 7 at 9:01

0

Your Answer

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

Browse other questions tagged or ask your own question.