Creating maps
We have the data that we need to begin building the map for our report. Our approach will be the following steps:
- Enhancing the elevation and base map images with filters
- Blending the images together to provide a hillshaded OSM map
- Creating a translucent layer to draw the street route
- Blending the route layer with the hillshaded map
These tasks will all be accomplished using the PIL Image
and ImageDraw
modules:
# Convert the numpy array back to an image relief = Image.fromarray(shaded).convert("L") # Smooth the image several times so it's not pixelated for i in range(10): relief = relief.filter(ImageFilter.SMOOTH_MORE) log.info("Creating map image") # Increase the hillshade contrast to make # it stand out more e = ImageEnhance.Contrast(relief) relief = e.enhance(2) # Crop the image to match the SRTM image. We lose # 2 pixels during the hillshade process base = Image.open(osm_img + ".jpg").crop((0, 0, w-2, h-2)) # Enhance base map contrast...