Projection problem from gdal2tiles.py to R Leaflet

144 views Asked by At

I do have a projection problem when making tiles with GDAL command and using the same for Leaflet in R. The steps I am following are:

  1. I save the Tiff in QGIs with the following configuration:

enter image description here

  1. In Centos Amazon Linux 2 and GDAL I Run the following command:

    gdal2tiles.py --s_srs EPSG:3857-WGS84 usa_tif.tif tiles

  2. After generating the tiles I get an openlayer.html which looks ok:

enter image description here

  1. But when I add the file into Leafet in R I get the following: enter image description here

Maybe you have an idea what is happening?

When I run:

 which gdalinfo; gdalinfo --version

I get:

GDAL 3.2.1, released 2020/12/29
1

There are 1 answers

0
RRuiz On BEST ANSWER

It was just a configuration in the Leaflet R code to:

tms = TRUE

addTiles(urlTemplate = "usa_tiles/{z}/{x}/{y}.png", group = "USA GDP", options = tileOptions(opacity = 0.6, tms = TRUE)) %>%