2

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.

  • 1
    you probably need to reproject your raster from 4326 to 3875 – Ian Turton Aug 19 '15 at 9:56
  • @iant : have added some more information. 3875? Havent heard of that one before.. – Simtrax Aug 19 '15 at 15:17
2

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.

  • Thank you. I've tried that. The result is better, but were not there yet. So if i check the result from MapTiler, the folder/files look like this: 16/35234/20501.png If i then check my result with gdal2tiles i have 16/35234/45032.png. When i try to view the tiles in leaflet (made with gdal) it works on zoom level 16. But the other zoom levels look strange. link I've tried changing tms, just to check, but that of course did nothing. So have you got any idea what's going on? – Simtrax Aug 19 '15 at 18:49
  • gdal2tiles uses a different method of tile numbering than MapTiler and leaflet. See this Q&A for solutions: gis.stackexchange.com/questions/63024/… – AndreJ Aug 19 '15 at 19:02
  • Before i try you're settings i'll just point that i'm using this version: gdal2tiles-leaflet Does you're settings still apply? I would guess they have taken care of that.. But i haven't been digging that deep in the source code. – Simtrax Aug 19 '15 at 19:31
  • I have tried the with your settings @AndreJ, with tms: false, and tms: true. But the tiles still appears out of order. Do you have any other suggestions? I'm happy for you're help. Thanks. – Simtrax Aug 19 '15 at 20:18
  • 1
    It might be a bug in gdal2tiles-leaflet. Can you try the original from GDAL, and tms=true in leaflet? – AndreJ Aug 20 '15 at 8:25

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.