Some Bits: Nelson's log

2 posts in May 2011

Digital elevation models

Doing some research on Digital Elevation Models, for making terrain maps.

SRTM

(Wikipedia, OSM Wiki) sourced from a space shuttle overflight in 2000. Comes in several flavours and sources.

Sources:

  • NASA source (download link). Original data. Version 2.1 is their latest, cleaned up by NGA. The NASA has some data voids, particularly at mountains and lakes. Documentation of the dataset.
    License: Data said to be fully open for any use; don’t have a specific reference.
  • CGIAR-CSI Data processed to remove voids. SRTM3 only. They publish it as “version 4.1”, version number reflects their data cleaning. Also available as an Amazon EBS volume.
    License: non-commercial with attribution.
  • HydroSHEDS. SRTM data with voids filled, SRTM3 only. Also vector data on watersheds. Technical documentation.
    License: “free for non-commercial use”
Details on NASA source:
SRTM1:
  • Resolution: 1 arc second, roughly 30m, z=12
  • Format: .HGT files, 3601x3601 per one degree square file. Each sample is 16 bits, height in meters (-32768 for no data). GDAL supports this format.
  • Coverage: Continental US, a bit of Alaska, and various US territories. Coverage map.
  • Size: 1117 files of 25 megs each, or 27 GB uncompressed. 2:1 compression with gzip.
SRTM3:
  • Resolution: 3 arc seconds, roughly 90m, z=10
  • Format: .HGT files as SRTM, 1201x1201 per one degree square file.
  • Coverage: global land mass from 60N to 56S. (Missing Antarctica, significant Northern parts of North America, Europe and Asia).  Coverage map.
  • Size: 14546 files of 2.8 megs each, or 39 GB. 2:1 compression with gzip.
SRTM30:
  • Resolution: 30 arc seconds, roughly 1km, z=7
  • Coverage: global from 90N to 60S. (Missing Antarctica). Coverage map. See also GTOPO30.

National Elevation Dataset

Wikipedia. Also NED FAQ. USGS data from various sources.
  • Resolution: 1 arc-second (z=12), 1/3 arc-second (z=14), and 1/9 arc-second (z=15).
  • Format: accessible via WMS. Data downloads provided in ArcGrid format and “float format”, looks like 32 bits / sample.
  • Coverage: United States and Mexico only. 1/3 for the 48 states, 1/9 in some detailed places. Coverage maps: 1 arcsecond, 1/3, 1/9
  • Size: files appear to be double the size of equivalent SRTM data. Rough guess: 50GB for 1 arc-second, 450GB for 1/3 arc-second.

Viewfinder Panoramas

Eclectic collection of more detailed / patched data than SRTM in certain spots. Unclear licensing.

ASTER GDEM

Joint NASA/Japan METI project, produces a 30m DEM. (Wikipedia, OSM Wiki) Has coverage between 83N to 83S and some holes filled compared to SRTM. Some question on quality; the data comes with a “quality assessment file”. May be free to use, but some concern on the OSM Wiki that its license is not consistent.

OpenDEM

Well intentioned but small project to provide better DEM data. Some useful notes.

GMTED2010

USGS project. Global data: 90S to 83N. 7.5 arc second (30m). Looks to be a combination of SRTM data and other sources. License is presumably public domainish. The metadata page says “Metadata access constraints: No restrictions, All GMTED2010 data products and associated metadata are publically available”.

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
    gdal2tiles.py -z 4-13 fisk.vrt
At that point, I was done! gdal2tiles.py 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.