gdal2tiles outputting wrong zoom levels for TOC maps

191 views Asked by At

I've been searching for any reference to the problem I am currently having but so far haven't found it being experienced by anyone else so I'm here asking for guidance on a possible solution.

I have a CADRG map in EPSG:4326 projection with a file structure that looks like this:

Map_Name
- rpf
  - cgnc
    - cgncz01
      - <#>.gn1
    - cgncz02
      - <#>.gn2
  - A.TOC

Where the TOC file describes the map and the *.gn* files are basic map information. CADRG is a weird format but it's supported by gdal and is what I'm required to work with. The problem I'm running into is when I run gdal2tiles.py on it, the output produces a zoom level higher than anticipated. i.e. zoom level 1 in the output is actually the expected zoom level 0 of map tools like Leaflet, meaning I have to post-process the output and downshift the zoom levels to make the tiles appear where they belong. I've confirmed this is the case as after downshifting, the generated map properly aligns with other world maps.

My first thought was that it was a bad CADRG map but I have confirmed this happens on multiple different CADRG maps, admittedly all from the same source however the source should be reliable. It also happens for ECRG maps which are again a TOC based map style.

I say all this because I'm hoping this is just a configuration issue I'm running into and that there's an easy fix other than post-processing the gdal2tiles output. If so, hopefully someone here will be able to give me pointers but if not I might need to contact the maintainers and see if they've experienced anything like this.

The command I use for the tile generation is this: python gdal2tiles.py -p geodetic -s epsg:4326 <#>.gn1 temp

1

There are 1 answers

0
MCBama On

So that will teach me to pay attention to manfiles. The online documentation doesn't mention it but gdal2tiles includes a --tmscompatible option that forces geodetic maps into the correct pyramid format for my use-case.

Undocumented help

The online document should be updated but I should also learn to read the manfiles a bit more.