Book Image

Python Geospatial Analysis Essentials

By : Erik Westra
Book Image

Python Geospatial Analysis Essentials

By: Erik Westra

Overview of this book

Table of Contents (13 chapters)
Python Geospatial Analysis Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Geospatial data errors and how to fix them


As you start working with geospatial data, you will soon discover that things don't always work the way you expect them to. OGR may crash when attempting to save a geometry into a shapefile, or Shapely may cause a system error when calculating the intersection of two polygons. While this can be frustrating, there are ways to solve these problems once you understand what causes them.

Geospatial data, and libraries such as GDAL/OGR and Shapely, are based around a mathematical model of how a geometry should be structured. Problems occur when your geospatial data doesn't meet this mathematical ideal. Let's take a look at what a mathematically-correct geometry looks like.

Points

While a coordinate is simply a pair of numbers, the range of acceptable values is limited. Imagine, for example, the following point geometries, which use WGS84 (that is, latitude and longitude coordinates):

POINT(-0.076 51.506)
POINT(2.295 48.858)
POINT(37.784 -122.402)

These points...