By default, "Generate XYZ Tiles (Directory)" uses XYZ tile scheme whereas "gdal2Tiles" uses TMS tile scheme.
The difference is XYZ convention starts tile numbering with coordinates 0, 0 from the top left corner whereas TMS convention starts it with the bottom left corner.
You may encounters other issues related to projections, tiling grid, dpi or tile size but you will need at least to use one scheme or another. To do so, you need:
- to tick the checkbox "Use inverted tile Y axis (TMS convention)" in "Generate XYZ Tiles (Directory)" algorithm
or
- cute & paste command in "GDAL/OGR console call" of "gdal2tiles" algorithm and add an
--xyzoption (see gdal2tiles.py doc) and run it from command line (did not see how it was possible to add--xyzoption within QGIS GUI !?)
In first case, all your generated tiles will use TMS generated tiles whereas in second case, they will all be XYZ based.
In fact, I lied a bit to simplify. It's also possible to consume mixed TMS and XYZ data sources but it would depend of clients consumption (the type of desktop GIS or webmapping library) but it would be "another story".
Edit:
I'm able to perfectly overlay them with the following recipesrecipe.
The PyQGIS line is the equivalent of the GUI "Generate XYZ Tiles (Directory)" call I've made
# Generate XYZ tiles (Directory) algorithm # My project is using EPSG 3857 and I've only ticked your sample image.tif processing.run("qgis:tilesxyzdirectory", {'EXTENT':'4022887.805000000,4048078.334600000,4192152.672100000,4217453.156000000 [EPSG:3857]','ZOOM_MIN':0,'ZOOM_MAX':13,'DPI':96,'BACKGROUND_COLOR':QColor(0, 0, 0, 0),'TILE_FORMAT':0,'QUALITY':75,'METATILESIZE':4,'TILE_WIDTH':256,'TILE_HEIGHT':256,'TMS_CONVENTION':False,'OUTPUT_DIRECTORY':'/tmp/xyz-qgis','OUTPUT_HTML':'TEMPORARY_OUTPUT'}) Run from command line as option --xyz not available within QGIS
# Gdal2tiles from QGIS + additional --processes=4 --xyz gdal2tiles.py -p mercator -z 0-13 -w all --processes=4 --xyz -r average -a 0.0 /home/thomasg/Téléchargements/image.tif /tmp/gdal2tiles See demo at https://labs.webgeodatavore.com/partage/demo-xyz-qgis-vs-gdal2tiles/openlayers.html (tick/untick the overlays in right button)