Book Image

IPython Interactive Computing and Visualization Cookbook

By : Cyrille Rossant
Book Image

IPython Interactive Computing and Visualization Cookbook

By: Cyrille Rossant

Overview of this book

Table of Contents (22 chapters)
IPython Interactive Computing and Visualization Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Manipulating geospatial data with Shapely and basemap


In this recipe, we will show how to load and display geographical data in the Shapefile format. Specifically, we will use data from Natural Earth (www.naturalearthdata.com) to display the countries of Africa, color coded with their population and Gross Domestic Product (GDP).

Shapefile (http://en.wikipedia.org/wiki/Shapefile) is a popular geospatial vector data format for GIS software. It can be read by Fiona, a Python wrapper to GDAL/OGR (a C++ library supporting GIS file formats). We will also use Shapely, a Python package used to handle two-dimensional geometrical shapes, and descartes, used to render Shapely shapes in matplotlib. Finally, we will use basemap to plot maps.

Getting ready

You need the following packages: