About this Book

I wrote Geoprocessing for Python to help you learn the basics of working with geospatial data, mostly using GDAL/OGR. There are other options, of course, but some of them build on top of GDAL, so if you understand the material in this book, you’ll probably be able to pick them up without too much trouble. This is not a book on GIS or remote sensing, although some background theory will be explained. Instead, this book will teach you how to write Python code for manipulating and creating spatial data, along with some simple analyses. You can use these building blocks to implement more-complicated analyses of your own devising.

Who should read this book

This book is for anyone who wants to learn to work with geospatial data. Some basics of GIS and remote sensing are explained so that readers new to geospatial analysis will know why they’re learning certain things, but the code starts out simple enough so that people with a geospatial background—but not much coding experience—will also benefit.

How this book is organized

This book is organized into 13 chapters. It starts out with a general introduction to geospatial data and Python and then covers vector data, spatial reference systems, raster data, and visualization.

  • Chapter 1 is an introduction to spatial data and analysis. It describes types of analyses you can perform with different types of data, along with the difference between vector and raster data and the uses of each.
  • Chapter 2 is a quick Python primer.
  • Chapter 3 explains what the OGR library is and teaches you how to read, write, and edit vector data sources.
  • Chapter 4 dives into the differences between vector formats. Although various formats can be treated the same in many cases, here you’ll learn about specific capabilities.
  • Chapter 5 teaches you how to filter and select data based on spatial and attribute relationships.
  • Chapter 6 describes the nitty-gritty details of creating and editing point, line, and polygon geometries.
  • Chapter 7 shows you how to look at spatial relationships between geometries and how you might use these concepts for simple analyses.
  • Chapter 8 includes an introduction to spatial reference systems and then teaches you how to work with them and transform data between them.
  • Chapter 9 explains what the GDAL library is and teaches you how to read and write raster datasets. It also shows you how to convert between real-world coordinates and pixel offsets.
  • Chapter 10 teaches you how to work with aspects of raster data such as ground control points, color tables, histograms, and attribute tables. It also covers the use of callback functions and error handlers.
  • Chapter 11 describes how to use NumPy and SciPy for map algebra, including local, focal, zonal, and global analyses, and covers some methods for resampling data.
  • Chapter 12 shows you some techniques for supervised and unsupervised map classification.
  • Chapter 13 teaches you how to use matplotlib and Mapnik to visualize your data.

If you’re familiar with spatial data and analyses, you can safely skip chapter 1. Similarly, if you’re already familiar with Python, then there’s no need to read chapter 2. If you’ve never programmed at all, you might find that you need to read a little more theory than can be provided in one chapter, but chapter 2 should be a good start, at least. If you’re only interested in vector data, you can ignore chapters 9-11. Likewise, if you’re only interested in raster data, chapters 3-7 can be skipped.

This book also has several appendixes. The first two, included in the pBook, contain installation instructions for the software used in this book and a list of data resources. Three additional appendixes (containing reference material for the three modules included with GDAL: ogr, osr, and gdal) are online-only and can be downloaded from www.manning.com/books/geoprocessing-with-python.

About the code

This book contains many examples of source code both in numbered listings and in line with normal text. In both cases, source code is formatted in a fixed-width font like this to separate it from ordinary text.

In many cases, the original source code has been reformatted; I’ve added line breaks and reworked indentation to accommodate the available page space in the book, and occasionally used line-continuation markers (). Additionally, comments in the source code have often been removed from the listings when the code is described in the text. Code annotations accompany many of the listings, highlighting important concepts.

I’ve tried to make variable names understandable while still keeping them short enough so that the code can fit on a line in the book. You might want to use more-descriptive variable names in your code, however.

Source code for the examples can be downloaded from www.manning.com/books/geoprocessing-with-python or from https://github.com/cgarrard/osgeopy-code. The example datasets are also available from the Manning link or from https://app.box.com/osgeopy.

Author Online

The purchase of Geoprocessing in Python includes free access to a private web forum run by Manning Publications, where you can make comments about the book, ask technical questions, and receive help from the author and from other users. To access the forum and subscribe to it, point your web browser to www.manning.com/books/geoprocessing-with-python. This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct on the forum.

Manning’s commitment to our readers is to provide a venue where a meaningful dialogue between individual readers and between readers and the author can take place. It is not a commitment to any specific amount of participation on the part of the author, whose contribution to the forum remains voluntary (and unpaid). We suggest you try asking her some challenging questions lest her interest stray! The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

Other online resources

If you need help with the Python language itself, there are a lot of tutorials online, such as the one at www.codecademy.com/learn/python.

If you need help with GDAL/OGR, the gdal-dev mailing list is a great place to ask questions and get advice. Sign up or view the archives at http://lists.osgeo.org/listinfo/gdal-dev.

The Python GDAL/OGR Cookbook found at https://pcjericks.github.io/py-gdalogr-cookbook/ contains a lot of useful examples.

After learning how to use OGR, you might also be interested in learning how to use Fiona (http://toblerity.org/fiona/), which is a module designed to read and write vector data and is built on top of OGR. Shapely (http://toblerity.org/shapely/) is a useful module for manipulating geometries.

Rasterio (https://github.com/mapbox/rasterio) is built on top of GDAL and is another good module for working with raster data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.119.159.178