How to Build Python Basemaps

How to Build Python Basemaps


Basemaps (http://matplotlib.github.com/basemap/) is a Python Matplotlib extension module extremely useful for plotting data on earth maps. It is a great module and the latest version (1.0.2) will be available in the Ubuntu 12.04 LTS repos. For now, however, you still need to download, build, and install yourself. The short writeup walks you through those steps. This was done on Ubuntu 10.04 LTS 64-bit with Python 2.7.

Download the latest version (http://sourceforge.net/projects/matplotlib/files/matplotlib-toolkits/) and copy to your Desktop (or somewhere else).

Uncompress the downloaded tarball like:

tar -xvf basemap-1.0.2.tar.gz

Change directory in the basemap-1.0.2 directory and then into the geos-3.3.1 subdirectory.

Setup an environment variable to install the geos library:

export GEOS_DIR=/usr/local/

Print it back to view it:

echo $GEOS_DIR

Now in the geos-3.3.1 directory install the geos library:

sudo ./configure --prefix=$GEOS_DIR

sudo make

sudo make install

Change directory back to the top level basemap directory and install basemaps:

python setup.py install

Now test out that you can import basemaps:

python

>> from mpl_toolkits.basemap import Basemap



ClassyBits 2016