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

Predicting flood inundation

In the remainder of the script, we load our terrain data from an ASCII Grid, define our output grid filename, and execute the algorithm on the terrain data. The seed of the flood fill algorithm is an arbitrary point, as sx and sy within the lower elevation areas. In a real-world application, these points would likely be a known location, such as a stream gauge or a breach in a dam. In the final step, we save the output grid.

The following steps need to be performed:

  1. First, we set up our source and target data names:
source = "terrain.asc"target = "flood.asc"
  1. Next, we open the source:
print("Opening image...")img = np.loadtxt(source, skiprows=6)print("Image opened")
  1. We'll create a mask array of everything below ...
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