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 net[1]. I think the most complete collection of map projections can be found at 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. [caption id=“attachment_961” align=“aligncenter” width=“650” caption=“Equirectangular projection”]mp_plattemp_platte[/caption]

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.

[caption id=“attachment_940” align=“aligncenter” width=“650” caption=“Mercator projection”]Mercator projectionMercator projection[/caption] 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. [caption id=“attachment_941” align=“aligncenter” width=“650” caption=“Miller cylindrical projection”]Miller cylindrical projectionMiller cylindrical projection[/caption] 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. [caption id=“attachment_969” align=“aligncenter” width=“611” caption=“Aitoff projection”]Aitoff projectionAitoff projection[/caption] 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. [caption id=“attachment_963” align=“aligncenter” width=“613” caption=“Mollweide equal area projection”]Mollweide equal area projectionMollweide equal area projection[/caption] 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. [caption id=“attachment_951” align=“aligncenter” width=“650” caption=“Gall-Peters projection”]Gall-Peters projectionGall-Peters projection[/caption] 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 scale[2]. [caption id=“attachment_965” align=“aligncenter” width=“587” caption=“Winkel-Tripel projection”]Winkel-Tripel projectionWinkel-Tripel projection[/caption] 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, 2007[3].

You can download all the ActionScript-Sources from my account on 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. ↩︎