
140
|
Chapter 3, Mapping Your World
#30 Plot a Great Circle on a Flat Map
HACK
to the cosine of the latitude, as would be depicted on a globe. Instead of
using the following code to determine the x-coordinate:
my $x = ($lon - $left) * $x_scale;
we could use this calculation to plot a sinusoidal projection of our data:
my $x = ($lon - $left) * $x_scale * cos( $lat );
Although this distorts the shapes of large areas, it’s easy to calculate, and it
preserves the relationship of latitude and longitude better at temperate lati-
tudes. For this reason, the TIGER Map Server makes use of the sinusoidal
projection, as discussed in “Make Free Maps of the United States Online”
[Hack #14].
We examine still other cartographic projections in “Experiment with Differ-
ent Cartographic Projections”
[Hack #28]. Still, no other projection beats the
Equidistant Cylindrical projection for ease of use, and there’s absolutely
something to be said for that.
See Also
• “View Your Photo Thumbnails on a Flash Map” [Hack #39]
• “Experiment with Different Cartographic Projections” [Hack #28]
• “Make Free Maps of the United States Online” [Hack #14]
• “Plot Points on an Interactive Map Using DHTML” [Hack #41]
• http://flatplanet.sourceforge.net/maps/
• http://mappinghacks.com/maps/
HACK
#30
Plot a Great Circle on a Flat Map Hack #30
Wherein our heroes discover that the shortest distance between two points
on a globe is not a straight ...