Mapping out all AEGEE locals

Update January 2007: Back in late 2006, I wrote a giant shell script in collaboration with the ITWG to make a proper map for AEGEE. It's now online here. The article below is my original "j'accuse" from May 2006, that thankfully was well received.

I've always found it a bit surprising that a large international student organisation like AEGEE fails so badly to communicate one of its core points: namely the size and extent of its network. If you go to the AEGEE homepage, you would never tell that they are represented in over 200 cities all over Europe. Instead of a clear overview map like every single budget airline, they give you an obtuse dropdown list. If you want to find out if there's a local AEGEE office near you, you really need to dig.

It's only when you go to the Network page that you get a map of all available locals – but judging by the presence of AEGEE-Den Haag, that map was last updated in 2002 or so. And I'm not even mentioning how clumsy a tiny clickmap with three kinds of unannotated symbols is.

Bringing proper mapping to AEGEE

In this article I'll ignore the fact that the AEGEE homepage is broken on so many levels (unreadable URLs, inconsistent design, sloppy, slow, buggy, incomplete, outdated, not even proper CSS) and focus on how to bring proper mapping into AEGEE. I want to promote the use of geographical information because maps are intuitive, they say a lot about AEGEE's presence, and they're done so poorly at the moment. This is probably because mapping is not a trivial thing. But it's not 1986 any more, there are plenty of computer tools to automate all the hard work.

Getting a list of all locals and their coordinates

To start off, we need a master list of all locals and their coordinates. It took me the better part of an evening to create that list (UTF-8 encoding), taking these steps:

  1. Fetch the AEGEE homepage with wget;
  2. Filter out the list of locals with grep -o;
  3. Cleaning up the list with grep, sed and awk;
  4. Converting AEGEE's country codes to those used by Heavens Above;
  5. Using a messy shell script to plug the country and city names into the Heavens Above Location Database one by one with wget and parsing the output;
  6. Doing extensive cleaning and completion of the file by hand.

Once having obtained the master file of all locals, their unique three-letter ID and their latitude and longitude, I could start mapping all the locals.

Mapping the locals

I choose to do my mapping with the GMT (Generic Mapping Tools) suite, which is open source, GPL'ed software. It is very powerful indeed and can create all sorts of maps. It is widely used by the scientific community and comes with an extensive dataset and many small utility programs. It's mature, it's great, I love it. GMT writes postscript code, which we can rasterize using Ghostscript.

A HTML clickmap

Let's start with the most practical example, a clickmap for use in HTML documents. It took me quite some time to figure out how to generate a clickmap using GMT, but I finally succeeded by translating Postscript coordinates to pixel coordinates using a fairly messy script.

The script (last modified Wednesday, 05-Jan-2011 01:21:44 CET)

Here's a basic Mercator projection of all the locals, with labels and clickable stars:

Shkoder Tiran├ź Innsbruck Kapfenberg-Graz Wien Bak─▒ Ganja Lenkoran Leuven Sofia Varna Sarajevo Grodno Horki Minsk Fribourg Gen├Ęve Lefkosia Lemessos Brno Plzen Praha Aachen Augsburg Bamberg Bayreuth Berlin Bremen Dresden Erfurt Erlangen-N├╝rnberg Freiburg Hamburg Heidelberg Kaiserslautern Karlsruhe Kiel K├Âln Konstanz Mainz/Wiesbaden Mannheim Marburg M├╝nchen M├╝nster Osnabr├╝ck Passau Stuttgart Trier T├╝bingen W├╝rzburg K├Şbenhavn Tallinn Tartu Alicante Barcelona Castell├│ Las Palmas Le├│n Madrid Oviedo Tarragona Valencia Zaragoza Helsinki Rovaniemi Turku/├ůbo Aix-en-Provence Bordeaux Lyon Paris Rennes Strasbourg Toulouse Borjomi Tbilisi Ath├şna Florina Heraklion Komotini P├ítra Peirai├ís Rodos Thessalon├şki Rijeka Zagreb Budapest Debrecen P├ęcs Szeged Szombathely Dublin Avellino/Benevento Bari Bergamo Bologna Brescia Cagliari Catania Cosenza Ferrara Firenze Forli Genova Lecce Messina Milano Napoli Padova Palermo Pavia Pisa Reggio Calabria Roma Salerno Siena Teramo Termoli Torino Trento Treviso Trieste Udine Venezia Verona Vilnius Riga Valletta Cahul Chi┼čin─âu Bitola Prilep Skopje Amsterdam Delft Eindhoven Enschede Groningen Leiden Maastricht Nijmegen Rotterdam Tilburg Utrecht Oslo Bialystok Gdansk Gliwice Katowice Krak├│w L├│d┼║ Lublin Nowy Sacz Opole Pozna┼ä Rzesz├│w S┼éupsk Toru┼ä Warszawa Wroclaw Zielona G├│ra Lisboa Alba Iulia Arad Bistri┼úa Bra┼čov Br─âila Bucure┼čti Cluj-Napoca Constan┼úa Craiova Ia┼či Oradea Pite┼čti Sibiu Sighetu Marmatiei Timi┼čoara T├«rgu-Mure┼č Kaliningrad Moskva Nizhni Novgorod Sankt-Peterburg Beograd Kragujevac Leskovac Niksic Ni┼í Novi Sad Podgorica Prishtina Subotica Link├Âping Lund Stockholm Ljubljana Maribor Nova Gorica/Gorizia Bratislava Komarno Adana Ankara Bolu ├çanakkale Diyarbak─▒r Erzurum Eski┼čehir Hatay Istanbul Izmir Kayseri Konya Malatya Ma─čusa Mersin Mu─čla Sakarya Tekirdag Trabzon Urla Dnipropetrovsk Ivano-Frankiv'sk Izmayil Kharkiv Ky├»v L'viv Mykolayiv Odessa Simferopol Uzhgorod Zaporizhia Cambridge Glasgow London Newcastle Oxford
Large click map

This map is clickable and hoverable.

Of course, given some time, this could be tweaked to include labels for all the locals, latitude/longitude lines, different symbols for contact/contact antenna/antenna status, et cetera. It's also possible to plot things like country borders, time zones, distances from one place to another, and so on.

A tiny but fully functional click map, made by changing the map width to 1 inch and the star size to 0.02 inch in the script above:

Shkoder Tiran├ź Innsbruck Kapfenberg-Graz Wien Bak─▒ Ganja Lenkoran Leuven Sofia Varna Sarajevo Grodno Horki Minsk Fribourg Gen├Ęve Lefkosia Lemessos Brno Plzen Praha Aachen Augsburg Bamberg Bayreuth Berlin Bremen Dresden Erfurt Erlangen-N├╝rnberg Freiburg Hamburg Heidelberg Kaiserslautern Karlsruhe Kiel K├Âln Konstanz Mainz/Wiesbaden Mannheim Marburg M├╝nchen M├╝nster Osnabr├╝ck Passau Stuttgart Trier T├╝bingen W├╝rzburg K├Şbenhavn Tallinn Tartu Alicante Barcelona Castell├│ Las Palmas Le├│n Madrid Oviedo Tarragona Valencia Zaragoza Helsinki Rovaniemi Turku/├ůbo Aix-en-Provence Bordeaux Lyon Paris Rennes Strasbourg Toulouse Borjomi Tbilisi Ath├şna Florina Heraklion Komotini P├ítra Peirai├ís Rodos Thessalon├şki Rijeka Zagreb Budapest Debrecen P├ęcs Szeged Szombathely Dublin Avellino/Benevento Bari Bergamo Bologna Brescia Cagliari Catania Cosenza Ferrara Firenze Forli Genova Lecce Messina Milano Napoli Padova Palermo Pavia Pisa Reggio Calabria Roma Salerno Siena Teramo Termoli Torino Trento Treviso Trieste Udine Venezia Verona Vilnius Riga Valletta Cahul Chi┼čin─âu Bitola Prilep Skopje Amsterdam Delft Eindhoven Enschede Groningen Leiden Maastricht Nijmegen Rotterdam Tilburg Utrecht Oslo Bialystok Gdansk Gliwice Katowice Krak├│w L├│d┼║ Lublin Nowy Sacz Opole Pozna┼ä Rzesz├│w S┼éupsk Toru┼ä Warszawa Wroclaw Zielona G├│ra Lisboa Alba Iulia Arad Bistri┼úa Bra┼čov Br─âila Bucure┼čti Cluj-Napoca Constan┼úa Craiova Ia┼či Oradea Pite┼čti Sibiu Sighetu Marmatiei Timi┼čoara T├«rgu-Mure┼č Kaliningrad Moskva Nizhni Novgorod Sankt-Peterburg Beograd Kragujevac Leskovac Niksic Ni┼í Novi Sad Podgorica Prishtina Subotica Link├Âping Lund Stockholm Ljubljana Maribor Nova Gorica/Gorizia Bratislava Komarno Adana Ankara Bolu ├çanakkale Diyarbak─▒r Erzurum Eski┼čehir Hatay Istanbul Izmir Kayseri Konya Malatya Ma─čusa Mersin Mu─čla Sakarya Tekirdag Trabzon Urla Dnipropetrovsk Ivano-Frankiv'sk Izmayil Kharkiv Ky├»v L'viv Mykolayiv Odessa Simferopol Uzhgorod Zaporizhia Cambridge Glasgow London Newcastle Oxford
Tiny click map

Tiny click map, fully functional.

Here's a really simple example of mapping all the Dutch locals:

#!/bin/bash

# Base map:
  pscoast \
    -K
    -R3/8/51/54 \
    -JM3i \
    -P \
    -G100 \
    -Df > dutchmap.eps

# Make coordinate file for stars:
  cat coordinates.txt | \
  awk 'BEGIN{FS=":"}{ print $4 " " $3 }' > coordinates.tmp
  psxy \
    -R -J -O -K \
    -Sa0.5c \
    -Gyellow \
    coordinates.tmp >> dutchmap.eps

# Close EPS file
  echo "9999 9999" | psxy -J -R -O >> dutchmap.eps

epstopdf dutchmap.eps
rm dutchmap.eps
rm coordinates.tmp
Dutch map

Dutch locals, screenshot of this PDF.

An orthographic map

ortho.sh

#!/bin/bash

# Make an orthographic map of all our locals

# Base map:
  pscoast \
    -K \
    -R-12/50/30/72 \
    -JG12/40/10c \
    -P \
    -G41/22/111 \
    -S153/204/255 \
    -Di > ortho.eps

# Make coordinate file for stars:
  cat coordinates.txt | \
  awk 'BEGIN{FS=":"}{ sub("[^0-9.-]", "", $4); print $4 " " $3 }' > coordinates.tmp

  psxy \
    -R -J -O -K \
    -Sa0.1c \
    -Gyellow \
     coordinates.tmp >> ortho.eps

# Close EPS file by writing dummy coordinate pair:
  echo "9999 9999" | psxy -J -R -O >> ortho.eps

# Make PDF, this corrects the bounding box:
  epstopdf ortho.eps

# Rasterize with Ghostscript
  gs \
    -r200 \
    -sDEVICE=png16m \
    -dGraphicsAlphaBits=4 \
    -dSAFER -dBATCH -dNOPAUSE \
    -sOutputFile=ortho.png \
     ortho.pdf

# Reduce colour
  pngquant 16 ortho.png
  mv ortho-fs8.png ortho.png

# Clean up
  rm ortho.eps
  rm ortho.pdf
  rm coordinates.tmp
Orthographical projection

Orthographical projection of the whole network.

Also, many different kinds of maps are possible, such as equidistant azimuthal projections:

equidistant_azimuthal.sh

#!/bin/bash

# Make an equidistant azimuthal projection

# Tallinn, Estonia:

  LAT=59.434
  LON=24.728

# Base map:

  pscoast \
    -K \
    -R0/360/0/90 \
    -JE$LON/$LAT/7i \
    -B15g15 \
    -Dl \
    -A1000 \
    -G200 \
    -W0.25p \
    -P > equidistant.eps

# Rings:

  grdmath \
    -Rg \
    -I1 \
    $LON \
    $LAT \
    SDIST \
    111.13 MUL \
    = dist.grd

  grdcontour \
    dist.grd \
    -A1000+v+ukm+kblack \
    -Glz-/z+ \
    -S8 \
    -C500 \
    -O \
    -J \
    -Wathin,red \
    -Wcthinnest,red,- >> equidistant.eps

  ps2pdf equidistant.eps
  rm equidistant.eps
  rm dist.grd
Equidistant azimuthal projection

Equidistant azimuthal projection centered on Tallinn, Estonia.

Upshot: we have a file with all the coordinates of all the locals and we have examples of how to map them, so it seems that the right people could incorporate this into the AEGEE IT systems with minimal effort.

Recommendations to the ITWG:

I'm open for questions, but I don't really have the incentive to implement an entire mapping system for AEGEE because I would really need to get into the messy Lotus Notes back-end, and from what I've heard it's hell on Earth.

Written May 20th, 2006