vis4.net

Hi, I'm Gregor, welcome to my blog where I mostly write about data visualization, cartography, colors, data journalism and some of my open source software projects.

Selected Map Projections in ActionScript

Update: I strongly recommend the use of as3-proj instead, which includes far more map projections and lots of other features.

Something you definitely need if you’re planning to create some geospatial visualizations from scratch is map projection. Map projection means the conversion of sphere coordinates (basically pairs of latitude and longitude values) to 2D-screen coordinates. While this is very easy for smaller regions like single countries things are getting complicated if you want to display the whole world. I’m not the right one to teach you all about map projections, you can read a lot about that on the net1. I think the most complete collection of map projections can be found at radicalcartography.net. I implemented a few of those projections in ActionScript. All classes are using the same interface, so they can easily be exchanged:

import net.vis4.geo.MapCoordinate;
import flash.geom.Point;

public interface MapProjection {
    function coord2point(ll:MapCoordinate):Point;
}

I proceed in showing an example and some short notes on each projection. You find the link to the sources #below.

Equirectangular projection

The equirectangular projection is the most simple projection because all latitude and longitude values are directly mapped to screen coordinates. I wouldn’t even call this a projection, but I added it for completeness.

Mercator projection

The Mercator projection is very popular because many online map services like Google Maps or Yahoo Maps are using it. It’s a cylindrical projection that’s well suited for navigation purposes and map display at lower scales. You should avoid it when you’re planning to display the whole world due to unacceptable distortions in polar regions.

Miller cylindrical projection

The Miller cylindrical projection provides small improvements of the Mercator projection by using a logarithmical scale for latitudes. But there are still too big distortions near the poles.

Aitoff projection

One way of minimizing distortions at pole regions is the usage of the Aitoff projection. It is a modified azimuthal map projection. The major drawback is the new introduced distortion on the west and east of the map.

Mollweide equal area projection

The Mollweide equal area projection, or just Mollweide projection, has the advantage of displaying all countries in equal areas which enables the viewer to compare relative country sizes.

Gall-Peters projection

The Gall-Peters projection is a another equal-area projection but it’s based on the cylindrical projection. It’s partly invented by Arno Peters, who complained a lot about the inequity of non equal-area projections in presentation of third world countries. Peters created the first world atlas that shows all countries in the same scale2.

Winkel-Tripel projection

After all, the Winkel-Tripel projection is the one I like the most. It basically the arithmetic mean between the equirectangular and the aitoff projection and provides a good trade-off between distortions and area equality. Unfortunately it’s not that easy to calculate the reverse mapping. For those interested in a technical comparision between different map projections I recommend reading the studies of Goldberg & Gott, 20073.

You can download all the ActionScript-Sources from my account on bitbucket.org. Feel free to use the code for whatever you want to.

Comments

World Map of Internet Adresses | vis4 | information visualization (Jan 12, 2010)

[…] created this visualization using ActionScript, based on my classes for map projections and polygon maths, which you can download for own usage. The data was extracted from the free […]


  1. E.g. Map projection
  2. The Peters World Atlas: The Earth in Its True Proportion, 2002, Arno Peters
  3. Flexion and Skewness in Map Projections of the Earth, 2007, David M. Goldberg & J. Richard Gott III, Cartographica, 2007, 42(4):297-318.