Orthoimage overlays

I figured out how to overlay USGS “DOQ” files in geotiff format over my terrain. (What you saw previously was a screen grab of some of their website data hand stretched over the terrain.. hehe). Now I’m actually rendering the real thing, at about 1 meter resolution.

The orthoimage for just the NE portion of the Corvallis quad is about 40mb alone. It takes a few seconds to load this guy. 🙂

Overlaying the geotiff files actually isn’t that tough. There’s an open source library called libgeotiff that does pretty much all of the hard work for you. Since DirectX can only load BMP/JPG files as textures I actually don’t even use the .tif file that comes as part of the geotiff file… I convert it to a .bmp and then use libgeotiff to pull out the metadata. Once I have the coordinates of the geotiff in UTM I can easily overlay it onto my height-map, it’s just a matter of scaling the coords into the texture coordinate system of the height-map.

Speaking of UTM, I should mention that I encountered some horrible floating point error dealing with UTM coordinates. The coordinates for Corvallis are something like (470187.46959, 4927222.852384). Big numbers. The spacing between heights in the elevation data file are somewhere around 0.00087. Well I can’t just go around adding floating point numbers of such different magnitudes together and expect things to work (I tried, heh), so I got around this by translating everything to the origin and working with the elevation and geotiff data in reference to 0,0 instead of those huge UTM coordinates. Everything is still UTM, it’s just offset by a lot.

I also downloaded some plant coverage data, part of the “national land cover dataset.” This also comes in geotiff format. Next I’m going to look at writing a vertex shader that draws little trees and grass where the land coverage data says they should be.

Leave a Reply