Converting an ESRI ASCII DEM to an image height map
To end this chapter with a bang, here is the most complicated conversion we have seen so far and the most fun as well. Input is an elevation dataset that's stored in ASCII format, more specifically, Arc/Info ASCII Grid, for short with the AAIGrid with the (.asc
) file ending. Our output is a heightmap image (http://en.wikipedia.org/wiki/Heightmap). A heightmap image is an image that stores height elevation as a pixel value. A heightmap is also simply known as a digital elevation model (DEM). The benefit of using an image to store elevation data is that it is web compatible and we can use this in a 3D visualization with
threejs, for example, as shown in Chapter 10, Visualizing Your Analysis.
Get Python Geospatial Analysis Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.