Book Image

Python Geospatial Development - Third Edition

By : Erik Westra
Book Image

Python Geospatial Development - Third Edition

By: Erik Westra

Overview of this book

Geospatial development links your data to locations on the surface of the Earth. Writing geospatial programs involves tasks such as grouping data by location, storing and analyzing large amounts of spatial information, performing complex geospatial calculations, and drawing colorful interactive maps. In order to do this well, you’ll need appropriate tools and techniques, as well as a thorough understanding of geospatial concepts such as map projections, datums, and coordinate systems. This book provides an overview of the major geospatial concepts, data sources, and toolkits. It starts by showing you how to store and access spatial data using Python, how to perform a range of spatial calculations, and how to store spatial data in a database. Further on, the book teaches you how to build your own slippy map interface within a web application, and finishes with the detailed construction of a geospatial data editor using the GeoDjango framework. By the end of this book, you will be able to confidently use Python to write your own geospatial applications ranging from quick, one-off utilities to sophisticated web-based applications using maps and other geospatial data.
Table of Contents (20 chapters)
Python Geospatial Development Third Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Recent developments


A decade ago, geospatial development was vastly more limited than it is today. Professional (and hugely expensive) geographical information systems were the norm for working with and visualizing geospatial data. Open-source tools, where they were available, were obscure and hard to use. What is more, everything ran on the desktop—the concept of working with geospatial data across the Internet was no more than a distant dream.

In 2005, Google released two products that completely changed the face of geospatial development: Google Maps and Google Earth made it possible for anyone with a web browser or desktop computer to view and work with geospatial data. Instead of requiring expert knowledge and years of practice, even a four-year-old could instantly view and manipulate interactive maps of the world.

Google's products are not perfect: the map projections are deliberately simplified, leading to errors and problems with displaying overlays. These products are only free for non-commercial use, and they include almost no ability to perform geospatial analysis. Despite these limitations, they have had a huge effect on the field of geospatial development. People became aware of what is possible, and the use of maps and their underlying geospatial data has become so prevalent that even cellphones now commonly include built-in mapping tools.

The Global Positioning System (GPS) has also had a major influence on geospatial development. Geospatial data for streets and other man-made and natural features used to be an expensive and tightly-controlled resource, often created by scanning aerial photographs and then manually drawing an outline of a street or coastline over the top to digitize the required features. With the advent of cheap and readily-available portable GPS units, as well as phones which have GPS built in, anyone who wishes to can now capture their own geospatial data. Indeed, many people have made a hobby of recording, editing, and improving the accuracy of street and topological data, which is then freely shared across the Internet. All this means that you're not limited to recording your own data or purchasing data from a commercial organization; volunteered information is now often as accurate and useful as commercially-available data, and may well be suitable for your geospatial application.

The open source software movement has also had a major influence on geospatial development. Instead of relying on commercial toolsets, it is now possible to build complex geospatial applications entirely out of freely-available tools and libraries. Because the source code for these tools is often available, developers can improve and extend these toolkits, fixing problems and adding new features for the benefit of everyone. Tools such as PROJ.4, PostGIS, OGR, and GDAL are all excellent geospatial toolkits that are benefactors of the open source movement. We will be making use of all these tools throughout this book.

As well as standalone tools and libraries, a number of geospatial application programming interfaces (APIs) have become available. Google has provided a number of APIs that can be used to include maps and perform limited geospatial analysis within a web site. Other sites, such as the OpenStreetMap geocoder we used earlier, allow you to perform various geospatial tasks that would be difficult to do if you were limited to using your own data and programming resources.

As more and more geospatial data becomes available from an increasing number of sources, and as the number of tools and systems that can work with this data also increases, it has become increasingly important to define standards for geospatial data. The Open Geospatial Consortium (http://www.opengeospatial.org) is an international standards organization that aims to do precisely this: provide a set of standard formats and protocols for sharing and storing geospatial data. These standards, including GML, KML, GeoRSS, WMS, WFS, and WCS, provide a shared language in which geospatial data can be expressed. Tools such as commercial and open source GIS systems, Google Earth, web-based APIs, and specialized geospatial toolkits such as OGR are all able to work with these standards. Indeed, an important aspect of a geospatial toolkit is the ability to understand and translate data between these various formats.

As devices with built-in GPS receivers have become more ubiquitous, it has become possible to record your location data while performing another task. Geolocation, the act of recording your location while you are doing something else, is becoming increasingly common. The Twitter social networking service, for example, now allows you to record and display your current location when you enter a status update. As you approach your office, sophisticated to-do list software can now automatically hide any tasks that can't be done at that location. Your phone can also tell you which of your friends are nearby, and search results can be filtered to only show nearby businesses.

All of this is simply the continuation of a trend that started when GIS systems were housed on mainframe computers and operated by specialists who spent years learning about them. Geospatial data and applications have been "democratized" over the years, making them available in more places, to more people. What was possible only in a large organization can now be done by anyone using a handheld device. As technology continues to improve and tools become more powerful, this trend is sure to continue.