Skip to Main Content
Learning Geospatial Analysis with Python - Third Edition
book

Learning Geospatial Analysis with Python - Third Edition

by Joel Lawhead
September 2019
Beginner content levelBeginner
456 pages
10h 53m
English
Packt Publishing
Content preview from Learning Geospatial Analysis with Python - Third Edition

Using PIL to visualize LIDAR data

The previous DEM images in this chapter were visualized using QGIS and OpenEV. We can also create output images in Python by introducing some new functions of the Python Imaging Library (PIL) that we didn't use in the previous chapters.

In this example, we'll use the PIL.ImageOps module, which has functions for histogram equalization and automatic contrast enhancement. We'll use PIL's fromarray() method to import the data from numpy. Let's see how close we can get to the output of the desktop GIS programs that were pictured in this chapter with the help of the following code:

import numpy as nptry: import Image import ImageOpsexcept ImportError: from PIL import Image, ImageOps# Source gridded LIDAR DEM file ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Geospatial Analysis with Python

Mastering Geospatial Analysis with Python

Silas Toms, Eric van Rees, Paul Crickard

Publisher Resources

ISBN: 9781789959277Supplemental Content