# 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 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. [caption id=“attachment_961” align=“aligncenter” width=“650” caption=“Equirectangular projection”]mp_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 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 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 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 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 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 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 bitbucket.org. Feel free to use the code for whatever you want to.