Sunday, April 19, 2015

Installing Python GIS Libraries on Ubuntu 14.04

I'm working my way through Python Geospatial Development, which as good fortune would have it, is the book we are using in my Introduction to GIS Algorithms and Programming course at George Mason University.  At the beginning of the course we were given a VirtualBox image of Ubuntu 12.04 with all the software and data files we need for the course preloaded.  Since I'm already running Ubuntu 14.04 as my regular desktop OS, I preferred to just install the packages (all of which are in the standard debian repositories) onto my desktop machines.

Here are the libraries we are using:
  • GDAL - The Geospatial Data Abstraction Library (see Python GDAL/OGR Cookbook for Python specific "recipes") for reading and writing geospatial data (GDAL for raster, OGR for vector).
  • pyproj - Performs cartographic transformations and geodetic computations.
  • Shapely - Manipulation and analysis of geometric objects in the Cartesian plane.
  • Mapnik - Toolkit for building mapping applications.
To install them for Python 2 on Ubuntu 14.04, run the following in a unix shell:
  • $ sudo apt-get install python-gdal
  • $ sudo apt-get install python-pyproj
  • $ sudo apt-get install python-shapely
  • $ sudo apt-get install python-mapnik2
Even on Ubuntu 15.04 Mapnik is only available for Python 2.  The other three libraries (gdal, pyproj, and shapely) are all available for Python 3.  This means that I will unfortunately have to use Python 2 for my mapping project.

I've now read the first eight chapters of Python Geospatial Development, which contain all the information I'll need for my project:
  • Chapter 1 - Geospatial Development Using Python
  • Chapter 2 - GIS
  • Chapter 3 - Python Libraries for Geospatial Development
  • Chapter 4 - Sources of Geospatial Data
  • Chapter 5 - Working with Geospatial Data in Python
  • Chapter 6 - GIS in the Database
  • Chapter 7 - Working with Spatial Data
  • Chapter 8 - Using Python and Mapnik to Produce Maps
It is often quite difficult to find good books about rapidly developing technologies like this, but this book does a good job.  The material is relevant, the presentation clear, and the examples both engaging and illuminating.

With background reading done and infrastructure setup, it is time to dig into the project.

1 comment:

  1. Thanks for sharing such a great information for Python. I learned with Dive into Python, and a french version of Thinking like a computer scientist.Thank you for sharing you blog..
    Best python Training Institute in Chennai