Creating the hillshade
We can run this data through the same hillshade algorithm used in the Creating a shaded relief section, in Chapter 7, Python and Elevation Data:
# Hillshade the elevation image log.info("Hillshading elevation data") im = Image.open(elv_img + ".jpg").convert("L") dem = np.asarray(im) # Set up structure for a 3x3 window to # process the slope throughout the grid window = [] # x, y resolutions xres = (maxx-minx)/w yres = (maxy-miny)/h # Create the windows for row in range(3): for col in range(3): window.append(dem[row:(row + dem.shape[0]-2), col:(col + dem.shape[1]-2)]) # Process each cell x = ((z * window[0] + z * window[3] + z * window[3] + z * window[6]) - (z * window[2] + z * window[5] + z * window[5] + z * window[8])) \ / (8.0 * xres * scale) y = ((z * window[6] + z * window[7] + z * window[7] + z * window[8]) - (z * window[0] + z * window[1] + z * window[1] + z * window[2])) \ ...