TransWikia.com

Generating tiles from multiple rasters - gdal2tiles.py

Geographic Information Systems Asked by CitizenFish on February 7, 2021

I have 3 rasters, each is in the same SRS but with differing extents

I want to combine them into a single tile set using gdal2tiles.py

eg:-

gdal2tiles.py -z '2-4' -e -p raster -r average --s_srs EPSG:27700 raster1.tif /tiles
gdal2tiles.py -z '5-8' -e -p raster -r average --s_srs EPSG:27700 raster2.tif /tiles
gdal2tiles.py -z '9-12' -e -p raster -r average --s_srs EPSG:27700 raster3.tif /tiles

When I try this the tiles are not centred correctly when zooming from 4 to 5 and then 8 to 9. I suspect this is due to inconsistent extents of the rasters. Or am I missing something else? Should I be wrapping them in a virtual raster

2 Answers

Came here looking for the same thing. I'm trying an alternative approach of merging the multiple .tif files into one. Check out: Merging tif images into a single GeoTiff with QGIS

Answered by Nikhil VJ on February 7, 2021

See my similar but not identical question at GDAL create mbtiles with differing image by zoom level about merging different rasters at specified zoom levels, but using gdal_translate and gdaladdo rather than gdal2tiles.

I would suggest you take the raster with the broadest extent and merge the smaller ones into it (i.e. make the broadest one the file called main.mbtiles in the answer provided there).

By the way, be aware that mbtiles viewer behaviour may be inconsistent if you are trying to display an area that is in some levels but not others. Depending on how you've set the extent metadata (which is what the merge above tries to do), and how the viewer responds to not finding a tile it requests, you may get blanks or a scaled version of a tile at a zoom level that does exist.

Answered by Houska on February 7, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP