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

Implementing the GPS Heatmap system


Now that we have the necessary data, we're ready to start implementing our GPS Heatmap system. Create a directory named gps-heatmap to hold the suite of programs and their associated data files, and then place the two data directories you created earlier (gps-data and roads) into this directory.

We're now ready to start coding. Let's start by implementing the init_db.py program to initialize our PostGIS database.

Initializing the database

You should already have installed Postgres when you worked through Chapter 3, Spatial Databases. We're going to use Postgres to create and initialize a database to hold all our processed road data. The first step is to create the database itself, which you can do by typing the following into a terminal window:

% createdb gps_heatmap

This should create a database named gps_heatmap. If you get an authentication error, you will need to enter a password or use the -U postgres command-line option so that the createdb command...