Visualising spatial data

http://www.scipy.org/Cookbook/Matplotlib/Maps?action=AttachFile&do=get&target=basemap3c.png

High level programming languages like e.g. Python, Matlab, R, IDL allow for the easy generation of maps by using specific modules. Alternatives to produce maps is special commerical or non-commercial software like e.g. ArcGIS, Generic mapping tool (GMT), ...

Map and projection basics

The Earth shape and it's approximation

How to do it in Python

There are different ways to generate maps with geographic information within Python. These are either based on the PyNGL (Gallery) or Basemap packages. PyNGL is very flexible to handle and allows for the generation of high quality maps. However, it takes a while to generate a nice looking map in PyNGL. If you just want to visualise your data, Basemap might be a very good alternative in many cases.

The Basemap way

   1 from mpl_toolkits.basemap import Basemap
   2 import matplotlib.pyplot as plt
   3 import numpy as np
   4 
   5 #/// define a map projection ///
   6 map = Basemap(projection='ortho', lat_0 = 50, lon_0 = -100,
   7               resolution = 'l', area_thresh = 1000.)
   8 
   9 #to see a list of potential projections, type help(Basemap)
  10 #be aware that each projection has different types of parameters
  11 
  12 #... you like coastlines?
  13 map.drawcoastlines()
  14 
  15 #... and countries
  16 map.drawcountries()
  17 
  18 #... fill continents
  19 map.fillcontinents(color = 'coral')
  20 
  21 #... draw coordinates
  22 map.drawmeridians(np.arange(0, 360, 30))
  23 map.drawparallels(np.arange(-90, 90, 30))

Load some vector data

References: