Book Image

Python Geospatial Analysis Cookbook

Book Image

Python Geospatial Analysis Cookbook

Overview of this book

Table of Contents (20 chapters)
Python Geospatial Analysis Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Other Geospatial Python Libraries
Mapping Icon Libraries
Index

Merging rasters to generate a color relief map


Generating a color relief raster is a one-liner with the gdaldem color-relief command line. If you want something that's a little more visually appealing, we will perform a combination of a slope, hillshade, and some color relief. Our end result is a single new raster representing a merge of layers to give a nice visual effect of elevation relief. The results are going to look similar to the following image:

Getting ready

For this exercise, you need to have the GDAL libraries installed that include the gdaldem command-line tool.

How to do it...

  1. Let's begin by extracting some key information out of our DEM using the gdalinfo\ch07\code>gdalinfo ../geodata/092j02_0200_demw.dem command-line tool as follows:

    Driver: USGSDEM/USGS Optional ASCII DEM (and CDED)
    Files: ../geodata/092j02_0200_demw.dem
           ../geodata/092j02_0200_demw.dem.aux.xml
    Size is 1201, 1201
    Coordinate System is:
    GEOGCS["NAD83",
        DATUM["North_American_Datum_1983",
            SPHEROID...