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.
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.
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.
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.
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.
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.
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.
18.119.159.178