Geoprocessing with Python
Chris Garrard
  • May 2016
  • ISBN 9781617292149
  • 360 pages
  • printed in black & white

Marvelous resource that demonstrates the ultimate power of geospatial data processing.

Dr. Rizwan Bulbul, Institute of Space Technology, Pakistan

Geoprocessing with Python teaches you how to use the Python programming language, along with free and open source tools, to read, write, and process geospatial data.

Table of Contents detailed table of contents

1. Introduction

1.1. Why use Python and open source?

1.2. Types of spatial data

1.3. What is geoprocessing?

1.4. Exploring your data

1.5. Summary

2. Python basics

2.1. Writing and executing code

2.2. Basic structure of a script

2.3. Variables

2.4. Data types

2.4.1. Booleans

2.4.2. Numeric types

2.4.3. Strings

2.4.4. Lists and tuples

2.4.5. Sets

2.4.6. Dictionaries

2.5. Control flow

2.5.1. If statements

2.5.2. While statements

2.5.3. For statements

2.5.4. Break, continue, and rise

2.6. Functions

2.7. Classes

2.8. Summary

3. Reading and writing vector data

3.1. Introduction to vector data

3.2. Introduction to OGR

3.3. Reading vector data

3.3.1. Accessing specific features

3.3.2. Viewing your data

3.4. Getting metadata about the data

3.5. Writing vector data

3.5.1. Creating new data sources

3.5.2. Creating new fields

3.6. Updating existing data

3.6.1. Changing the layer definition

3.6.2. Adding, updating, and deleting features

3.7. Summary

4. Working with different vector file formats

4.1. Vector file formats

4.1.1. File-based formats such as shapefiles and geoJSON

4.1.2. Client-server database formats such as PostGIS

4.2. Working with more data formats

4.2.1. SpatiaLite

4.2.2. PostGIS

4.2.3. Folders as data sources (shapefiles and csv)

4.2.4. Esri file geodatabases

4.2.5. Web feature services

4.3. Testing format capabilities

4.4. Summary

5. Filtering data with OGR

5.1. Attribute filters

5.2. Spatial filters

5.3. Using SQL to create temporary layers

5.4. Taking advantage of filters

5.5. Summary

6. Manipulating geometries with OGR

6.1. Introduction to Geometries

6.2. Working with points

6.2.1. Creating and editing single points

6.2.2. Creating and editing multipoints: Multiple points as one geometry

6.3. Working with lines

6.3.1. Creating and editing single lines

6.3.2. Creating and editing multilines: Multiple lines as one geometry

6.4. Working with polygons

6.4.1. Creating and editing single polygons

6.4.2. Creating and editing multipolygons: Multiple polygons as one geometry

6.4.3. Creating and editing polygons with holes: Donuts

6.5. Summary

7. Vector analysis with OGR

7.1. Overlay tools: what’s on top of what?

7.2. Proximity tools: how far apart are things?

7.3. Example: locating areas suitable for wind farms

7.4. Example: animal tracking data

7.5. Summary

8. Using spatial reference systems

8.1. Introduction to spatial reference systems

8.2. Using spatial references with OSR

8.2.1. Spatial reference objects

8.2.2. Creating spatial reference objects

8.2.3. Assigning a SRS to data

8.2.4. Reprojecting geometries

8.2.5. Reprojecting an entire layer

8.3. Using spatial references with pyproj

8.3.1. Transforming coordinates between spatial reference systems

8.3.2. Great-circle calculations

8.4. Summary

9. Reading and writing raster data

9.1. Introduction to raster data

9.2. Introduction to GDAL

9.3. Reading partial datasets

9.3.1. Using real-world coordinates

9.3.2. Resampling data

9.4. Byte sequences

9.5. Subdatasets

9.6. Web map services

9.7. Summary

10. Working with raster data

10.1. Ground control points

10.2. Converting pixel coordinates to another image

10.3. Color tables

10.3.1. Transparency

10.4. Histograms

10.5. Attribute tables

10.6. Virtual raster format

10.6.1. Subsetting

10.6.2. Creating troublesome formats

10.6.3. Reprojecting images

10.7. Callback functions

10.8. Exceptions and error handlers

10.9. Summary

11. Map algebra with NumPy and SciPy

11.1. Introduction to NumPy

11.2. Map algebra

11.2.1. Local analyses

11.2.2. Focal analyses

11.2.3. Zonal analyses

11.2.4. Global analyses

11.3. Resampling data

11.4. Summary

12. Map classification

12.1. Unsupervised classification

12.2. Supervised classification

12.2.1. Accuracy assessments

12.3. Summary

13. Visualizing data

13.1. Matplotlib

13.1.1. Plotting vector data

13.1.2. Plotting raster data

13.1.3. Plotting 3D data

13.2. Mapnik

13.2.1. Drawing vector data

13.2.2. Storing information as XML

13.2.3. Drawing raster data

13.3. Summary

Appendixes

Appendix A: Installation

A.1. Anaconda

A.2. Non-bundled installations

A.2.1. Linux

A.2.2. Mac OS X

A.2.3. Windows

A.3. Environment variables

A.4. Source code and data

A.5. Development environments

Appendix B: References

Appendix C: OGR

Appendix D: OSR

Appendix E: GDAL

About the Technology

This book is about the science of reading, analyzing, and presenting geospatial data programmatically, using Python. Thanks to dozens of open source Python libraries and tools, you can take on professional geoprocessing tasks without investing in expensive proprietary packages like ArcGIS and MapInfo. The book shows you how.

About the book

Geoprocessing with Python teaches you how to access available datasets to make maps or perform your own analyses using free tools like the GDAL, NumPy, and matplotlib Python modules. Through lots of hands-on examples, you’ll master core practices like handling multiple vector file formats, editing geometries, applying spatial and attribute filters, working with projections, and performing basic analyses on vector data. The book also covers how to manipulate, resample, and analyze raster data, such as aerial photographs and digital elevation models.

What's inside

  • Geoprocessing from the ground up
  • Read, write, process, and analyze raster data
  • Visualize data with matplotlib
  • Write custom geoprocessing tools
  • Three additional appendixes available online

About the reader

To read this book all you need is a basic knowledge of Python or a similar programming language.

About the author

Chris Garrard works as a developer for Utah State University and teaches a graduate course on Python programming for GIS.


Buy
  • combo $49.99 pBook + eBook
  • eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Code examples may be in Python, but the concepts work for all languages. Great book!

Karsten Strøbæk, Microsoft, Western Europe, Consulting Services

A must-have for GIS professionals wishing to take their maps to the next level.

Jacqueline Wilson, Cecil College