[GIS] gdal2tiles georeferenced image as overlay not working

gdalgdal2tilesgeotiff-tiffimagerytiles

I'm using gdal2tiles-leaflet to create tiles for my Leaflet application.
The images I use are GeoTiff's with the embedded projection WGS84, they are in flight photos taken by a drone.

So I tried gdal2tiles-leaflet. I successfully created a map where I can navigate the image. It works great. But the image is not working properly when I use it as a overlay layer on a normal map, with other base layers. Such as open street map.
The image is then super large, so I have to zoom out really much. And the image covers almost the whole earth. So it's basically not georeferenced in the way I'd like it to be.

Here's some of the commands that I've been using:

gdal2tiles-multiprocess.py -l -p raster -z 0-9 test.tif tiles
gdal2tiles-multiprocess.py -l -p raster -z 0-7 -s src.prj -w all test.tif tiles
gdal2tiles-multiprocess.py -l -p raster -z 0-7 -s src.prj -t "+proj=longlat +ellps=WGS84" -w all test.tif tiles
gdal2tiles-multiprocess.py -l -p geodetic -z 14-15 test.vrt

I've tried different zoom levels, raster, geodetic and so on. But I can't seem to get the result I'm looking for.

I know that MapTiler has the functionality to get this to work, I've tried it on a smaller image. But the application does not really fit in to my workflow on the server everything is hosted on.
So I would like to be able to use gdal2tiles-leaflet.

I pretty certain I'm just missing some small thing.

Best Answer

Openlayers and leaflet usually render tiles in World Mercator EPSG:3857.

So you have to reproject your source file into that projection using gdalwarp, then start the tiling.