Recently I've spent much of my time trying to plot a map and visualizing data resulted from my simulation program. After reading here and there I found basemap and matplotlib to be the most suitable choice in my opinion. This short tutorial is posted as a personal note which might be useful in the future, in case I need to reinstall basemap on my PC.
1. Using Synaptic Package Manager, do install python 2.7.1, numpy 1.5.1, python-matplotlib 0.99.3, libgeos-dev 3.2.0-1, shapelib 1.2.10-5, python-imaging 1.1.7-2build2 and all of their respective dependencies.
2. Download the basemap-1.0.1.tar.gz from here:
3. Using Archive Manager, extract the file: basemap-1.0.1.tar.gz
4. Run the following commands:
username@my-ubuntu:~Downloads$ cd basemap-1.0.1/
username@my-ubuntu:~Downloads$ python setup.py install
5. Check the installation:
username@my-ubuntu:~Downloads$ cd examples/
username@my-ubuntu:~Downloads$ python simpletest.py
If it displays a map on the screen, then all is set. This works for me, so I hope this will also work for you!
Added on Oct. 17:
I just got my Ubuntu 11.10 upgrade and suddenly basemap error occurs. It could not find libgeos-3.2.0.so which was understandable because Ubuntu upgrade remove this "old package" of libgeos-3.2.0.so and install the new libgeos-3.2.2.so.
ImportError: libgeos-3.2.0.so could not be found by this line: import _geoslib
However, when I tried reinstalling basemap, libgeos-3.2.2.so could be found when running
my-ubuntu$ sudo python setup.py install
So problem was _geoslib.so which somehow was still looking for libgeos-3.2.0.so. I needed to build a new _geoslib.so with the new libgeos-3.2.2.so
The following steps are to cure this:
1. Remove _geoslib.so in /usr/local/lib/python2.7/dist-packages/
2. Change directory to
3. Remove this folder --> lib.linux-x86_64-2.7/
4. Reinstall basemap-1.0.1 by running sudo python setup.py install