I have been converting a raster consisting of 5m pixels to xyz tiles with PNG format in order to be consumed by Mapbox as a layer. I have been using gdal2tiles.py to achieve this and have been hosting them in S3, however I have noticed that there are some pixels missing when comparing the view on Mapbox compared to when viewing the raster in QGIS.

My process has been:

  1. Apply qml style to raster in QGIS
  2. Export raster as geotiff file from QGIS with the following settings

screenshot from QGIS

(compression was set to high and I removed the field: PREDICTOR=2

  1. Run gdal2tiles.py like this:

gdal2tiles.py {file} --xyz --zoom=8-18 --processes={cores} --exclude

I put the above in because it could be something in my process that is causing the inaccuracies.

What is the most accurate way to generate a tileset from a raster file? I am curious about things like whether tms more accurate than xyz, or if there is a more accurate tool than gdal2tiles.py, or if I have done something to cause these inaccuracies myself.

Here are some images to illustrate: enter image description here

enter image description here

The first picture is how it looks in Mapbox, the second in QGIS. You can see in QGIS there are 4 pixels up, whereas in Mapbox there are only 3.

  • 1
    those seem to be at different scales
    – Ian Turton
    Aug 3 at 12:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.