Notes on building a slippy map of the Fisk maps

I got interested in these Fisk maps of the Mississippi, so I’m making a slippy map. Here’s what I did.

  1. Downloaded the rectified TIFFs from the Army. These have already been rotated and georeferenced and are pretty high resolution. The p22* files are the maps I worked with.
  2. Created pyramidal overviews for the TIFFs so I could explore them in QuantumGIS more quickly. Not strictly necessary, and in fact may be harmful: gdal2tiles seems to pick up the JPG compression.
    gdaladdo -r average –config COMPRESS_OVERVIEW JPEG –config PHOTOMETRIC_OVERVIEW YCBCR –config INTERLEAVE_OVERVIEW PIXEL -ro p22_s12.tif 2 4 8 16 32
  3. Created a virtual raster layer including properly annotated sections of no data
    gdalbuildvrt -srcnodata “255 255 255” fisk.vrt *.tif
  4. Generated slippy map tiles -z 4-13 fisk.vrt
At that point, I was done! includes a Google maps interface that works. Of course I couldn’t leave well enough alone, so I wrote my own Javascript interface using Polymaps.
Some other caveats and notes:
Data quickly gets big and slow. The source map is only 32 megs of TIFFs, maybe 10,000 x 150,000 pixels. But all the cutting and repackaging and uploading is going to take hours. I did OK experimenting with a small subset (just 2 TIFFs of 15). I decided to cut the render to z=13 instead of going full resolution to z=14: 4x speedup! (Final result: roughly 6 hours CPU, 230 megs of GIFs for the tiles).
The source TIFFs include page margins. A proper seamless map would require cutting those off by hand. I didn’t bother for this quick hack.
Output image format is a problem. The default PNG output of gdal2tiles is enormous. Some details, including file size of the tileset for a sample input of only 2 of the TIFFs
  1. 32 megs: source TIFFs (sheets 12 and 13 only)
  2. 60 megs: gdal2tiles output, 24 bit PNGs with transparency. (was 220 megs at z=14)
  3. 50 megs: optipng. Doesn’t help as much as I need, only 10-20%.
  4. 15 megs: JPG. These would be awesome, but I need transparency because the source maps aren’t rectangular
  5. 24 megs: 8 bit PNGs with transparency. Unfortunately imagemagick’s PNG8 conversion is buggy, particularly with transparency, and I can’t use it.
    convert foo.png PNG8:foo-8.png
  6. 28 megs: GIFs. imagemagick does a good job emitting GIFs with transparency.