0977: "Map Projections"

This forum is for the individual discussion thread that goes with each new comic.

Moderators: Moderators General, Prelates, Magistrates

wildgunman
Posts: 5
Joined: Thu Jun 02, 2011 2:19 pm UTC

Re: 0977: "Map Projections"

Postby wildgunman » Mon Nov 14, 2011 4:49 pm UTC

I love the Mercator projection. It is an elegant, simple mathematical solution to a complex problem. Moreover, nearly everyone ignores it's original intent which is that it is the correct North-South/East-West projection everywhere for navigational purposes, a function it fulfills marvelously. It is the simplest way to preserve direction. It may be wrong, but because it's construction is so straightforward and honest, I can always tell you exactly why and where it is wrong.

I also find the comment about Gall-Peters to be 100% accurate. There is just no reason to prefer a projection that is both this complex and this wrong, and the only reason anyone even knows about that stupid projection is because Peters was a raving lunatic who liked to yell very loud and knew how to manipulate the political fringe into also yelling very loud. If you prefer Gall-Peters it is literally because you are filled with hate, and need to express that hate in map form.

Cousj001
Posts: 33
Joined: Wed Aug 31, 2011 10:55 am UTC

Re: 0977: "Map Projections"

Postby Cousj001 » Mon Nov 14, 2011 4:55 pm UTC

How about a globe with the south pole at the top of the axis? Or, if you want a 2D map, the sinusoidal? Lambert's Cylindrical is an equal area afro-centric map some might like. I also quite like Eckert IV, its equal area but the shapes still seem reasonably pleasing.
Magic is real, unless declared integer.

Wolby
Posts: 27
Joined: Fri Jul 31, 2009 5:14 pm UTC
Location: Washington, D.C.

Re: Map Projections

Postby Wolby » Mon Nov 14, 2011 4:57 pm UTC

Meyermagic wrote:
Meyermagic wrote:I'm quite glad this comic showed up, because it gives me an opportunity to try and find something I've been wanting to find for over a year now.

A few years ago I saw a map projection that was generated algorithmically to minimize distortion to "important" metrics on the globe (distance between things and landmass and whatnot). It came out looking somewhat like a Dymaxion map, but instead of sliding around a globe on an unfolded icosahedron so that the cuts don't intersect land, it started with a sphere and made many small "tears", preserving "important" features, then unfolded the sphere in a similar way. It produced an output that was more visually pleasing than the Dymaxion map, and did a better job of preserving distance between and within landmasses, but was probably also more confusing around the edges, where the many small tears were.

I've tried to find this again, but my Google-Fu must not be strong enough. I'm going to hope someone on this forum knows what I'm talking about; it seems like the right place.


Wait, I found it!

http://www.win.tue.nl/~vanwijk/myriahedral/
http://www.newscientist.com/article/dn18264-clever-folds-in-a-globe-give-new-perspectives-on-earth.html

The video: http://www.youtube.com/watch?v=b1xXTi1nFCo


I always really liked Dymaxion, but this is an even sexier generalization of that solution. Thanks!

The coastline one is nifty in principle, but most of the things I can think of to map on it have something to do with latitude (eg biological productivity measures, temperature and/or density profiles, currents).

Like ctrlburn, I'm also fond of ones with, say, the Northwest Passage.

User avatar
Vnend
Posts: 58
Joined: Thu Oct 30, 2008 5:34 pm UTC

Re: Map Projections

Postby Vnend » Mon Nov 14, 2011 5:05 pm UTC

Jonathan SCE wrote:Here is a commercial version of a digital globe, they make a 16" globe:
http://www.globalimagination.com/products.html

and here is a DIY version:
http://www.howtogeek.com/95595/diy-3d-p ... ojections/

On a related note, here is a wallpaper that updates with current cloud cover and day/night shadow.
http://codefromthe70s.org/desktopearth_dl.aspx


Thank you.

There really needs to be a generalization of Rule 34, it is so often true. Unfortunately, you still have to contend with Sturgeon's law.

webgrunt
Posts: 128
Joined: Thu Apr 21, 2011 4:04 pm UTC

Re: 0977: "Map Projections"

Postby webgrunt » Mon Nov 14, 2011 5:08 pm UTC

My all-time favorite wall map is a Mercator in which the split runs right through Asia. In other words, Asia runs off the map on the right side and continues on the left. Why split a country instead of an ocean? It's not an ocean map, so the only reason I can see as to why it was done this way is so that the United States can be exactly in the left-right center of the map, which it is. I love this map for the sheer, knuckle-headed arrogance of it.

klarno
Posts: 1
Joined: Mon Nov 14, 2011 5:04 pm UTC

Re: 0977: "Map Projections"

Postby klarno » Mon Nov 14, 2011 5:17 pm UTC

In my youth, I distinctly remember that the first Basically Decent thing I encountered that really pissed me off was a reversed Gall-Peters map. Everything was wrong with it. Since my brother's name is Peter, I probably blamed him for it.

User avatar
Vnend
Posts: 58
Joined: Thu Oct 30, 2008 5:34 pm UTC

Re: 0977: "Map Projections"

Postby Vnend » Mon Nov 14, 2011 5:17 pm UTC

And suddenly I have this urge to play with maps, globes and anamorphic projections...

Jacke
Posts: 1
Joined: Mon Nov 14, 2011 7:34 am UTC

Re: 0977: "Map Projections"

Postby Jacke » Mon Nov 14, 2011 5:23 pm UTC

If you are a navigator, you like the good old Mercator! You know about the distortions, but try doing courses, measuring bearings, or doing celestial nav on the others...

User avatar
Meng Bomin
Posts: 28
Joined: Wed Nov 12, 2008 10:28 am UTC

Re: 0977: "Map Projections"

Postby Meng Bomin » Mon Nov 14, 2011 5:41 pm UTC

Personally, my favorite is the Peirce Quincuncial, but I must say that Randall's description didn't resonate much with me. It should be noted that it does matter what longitude the map is centered on and in my opinion, it is best when centered on about 25°W/155°E, as Randall drew it and the example map in Wikipedia used to be:
http://commons.wikimedia.org/wiki/File: ... ection.jpg

rather than as it currently is, centered on 0°/180°:
http://en.wikipedia.org/wiki/File:Peirc ... ion_SW.jpg

My reason for support of the Peirce Quincuncial is that it displays the continents with relatively little distortion (when centered correctly), it fits into a nice rectangular form, and can be tiled to nice effect. It shows the relationship of the continents relative to the poles in a way that most standard equatorially centered maps don't. The Dymaxion map is similar to that effect, but it's use of an unfolded icosahedron, while it maintains relatively low local distortion across the board, loses out in broad appearance with its jagged edges and visible bending of the South American continent, for instance.

I don't qualify as a hippie myself, but I would put out an appeal to those concerned about cultural imperialism who have misguidedly latched on to equal-area cylindrical projections: the distortion both at the poles and the equator that is created by Gall-Peters and Hobo-Dyer is really ugly and it doesn't actually contribute to an accurate picture of the world. Further, in eschewing most maps framing of the world in north-south terms, the Peirce Quincuncial allows for the display of the world without concern for who is "up" or "down" while fitting into a rectangular area. You'll find that the effect is even better if you tile the map.

User avatar
Severius
Posts: 4
Joined: Fri Dec 07, 2007 11:17 pm UTC

Re: 0977: "Map Projections"

Postby Severius » Mon Nov 14, 2011 5:43 pm UTC

Bellerophon wrote:I spent far too long going between Robinson and Winkel Tripel, but I think I'm happy with the Kavrayskiy.


Ha, me too. I found I really like the Kavrayskiy. Now, does anyone know where I can get a nice wall map of it?

DoMakeSayThink
Posts: 10
Joined: Mon Aug 16, 2010 9:46 pm UTC

Re: 0977: "Map Projections"

Postby DoMakeSayThink » Mon Nov 14, 2011 5:44 pm UTC

I'm really surprised nobody has yet suggested the stereographic projection, unless it's given a different name by cartographers. It's definitely my favourite, and it makes the endeavours of Amundsen and Scott all the more impressive (if you project from the south pole).

paddyfool
Posts: 27
Joined: Wed Apr 08, 2009 3:54 pm UTC

Re: 0977: "Map Projections"

Postby paddyfool » Mon Nov 14, 2011 5:46 pm UTC

I like Mollweide, Robinson, Winkel-Tripel and Kavreyskiy; generally the best straightforward maps. I do see the navigational use of the equirectangular, or even (bleurgh), the Mercator, but dislike the degree of distortion that's introduced.

If I was ever to get very drunk and get a tattoo of a world map, though, I'd hope it was the Waterman butterfly. And that it would somehow (a) be pretty accurate and (b) keep it's shape. But then, I might as well wish for the moon...

snoods
Posts: 12
Joined: Mon Nov 14, 2011 5:36 pm UTC

Re: 0977: "Map Projections"

Postby snoods » Mon Nov 14, 2011 5:52 pm UTC

Only xkcd can get over 130 posts in a thread genuinely about maps. On the subject of "south up maps", could you not just get a normal map and, you know, turn it round?

wtrbg
Posts: 1
Joined: Mon Nov 14, 2011 5:54 pm UTC

Re: 0977: "Map Projections"

Postby wtrbg » Mon Nov 14, 2011 6:03 pm UTC

Would LOVE to have this comic in poster form! Anyone else? There's gotta be some other geography nerds out there

chrth
Posts: 140
Joined: Tue Mar 17, 2009 4:54 pm UTC

Re: 0977: "Map Projections"

Postby chrth » Mon Nov 14, 2011 6:12 pm UTC

Sir_Read-a-Lot wrote:My favorite map is this one.

(true, chrth got there before me, but he didn't use the original version).


But that's just the map; I posted the projection of Middle-Earth onto Europe.

User avatar
rhomboidal
Posts: 796
Joined: Wed Jun 15, 2011 5:25 pm UTC
Contact:

Re: 0977: "Map Projections"

Postby rhomboidal » Mon Nov 14, 2011 6:13 pm UTC

My favorite map would be any modern one that still has dragons, Atlantis, and sea monsters drawn on it because the mapmaker finally decided that "people need to know."

User avatar
Idhan
Posts: 319
Joined: Sun Sep 07, 2008 10:33 pm UTC

Re: 0977: "Map Projections"

Postby Idhan » Mon Nov 14, 2011 6:20 pm UTC

I think that if Eisenlohr projection is your favorite, that probably means you're a sexual deviant.

If August Conformal is your favorite, you're a lazy deviant.

If any retroazimuthal projection is your favorite, the DHS will add you to the No-Fly List.

Update: Personally, I do like Eisenlohr, but Hammer-Aitoff is my favorite for general purposes.
Last edited by Idhan on Mon Nov 14, 2011 6:45 pm UTC, edited 1 time in total.

User avatar
steve waterman
Posts: 1610
Joined: Mon Nov 14, 2011 4:39 pm UTC

Re: 0977: "Map Projections"

Postby steve waterman » Mon Nov 14, 2011 6:24 pm UTC

i am the author of the Waterman "butterfly" map. It is uniquely generated projection based upon the mathematics of close packed spheres. A low resolution version can be seen here on my main page at http://www.watermanpolyhedron.com/

Here is another page or two from my site that attempts to explain/foist why I believe this projection has superior qualities to other maps.
http://www.watermanpolyhedron.com/worldmap.html
http://www.watermanpolyhedron.com/maps.html

Many thanks to Randall for including my projection in his recent comic.

steve waterman

Brett Dunbar
Posts: 6
Joined: Sat Aug 27, 2011 1:07 am UTC

Re: 0977: "Map Projections"

Postby Brett Dunbar » Mon Nov 14, 2011 6:42 pm UTC

wildgunman wrote:I love the Mercator projection. It is an elegant, simple mathematical solution to a complex problem. Moreover, nearly everyone ignores it's original intent which is that it is the correct North-South/East-West projection everywhere for navigational purposes, a function it fulfils marvellously. It is the simplest way to preserve direction. It may be wrong, but because it's construction is so straightforward and honest, I can always tell you exactly why and where it is wrong.

I also find the comment about Gall-Peters to be 100% accurate. There is just no reason to prefer a projection that is both this complex and this wrong, and the only reason anyone even knows about that stupid projection is because Peters was a raving lunatic who liked to yell very loud and knew how to manipulate the political fringe into also yelling very loud. If you prefer Gall-Peters it is literally because you are filled with hate, and need to express that hate in map form.


If you want a rectangular world map and you want it to be an equal area projection it is a fairly reasonable choice from the cylindrical equal-area projection family. There are political reasons for choosing an equal area projection rather than something like Mercator which while fine as a navigational map is absolutely horrible as a political statement.

barbarossa
Posts: 1
Joined: Mon Nov 14, 2011 6:35 pm UTC

Re: 0977: "Map Projections"

Postby barbarossa » Mon Nov 14, 2011 6:48 pm UTC

Rotating maps or changing their center points is as chauvinistic as the orientations they seek to supplant. The problem remains insisting on keeping the terms of the game but changing the players.

Center versus periphery and top versus bottom (sexual/gender associations not to be ignored) are the binaries to reject if you actually care about the politics of maps and don't simply want to be in the privileged position.

llamswerdna
Posts: 1
Joined: Mon Nov 14, 2011 6:44 pm UTC

Re: Map Projections

Postby llamswerdna » Mon Nov 14, 2011 6:57 pm UTC

Proginoskes wrote:
ctrlburn wrote:What does it mean when you like the "South Up Map"?
http://en.wikipedia.org/wiki/Reversed_map


I was kind of wondering about that one, myself.


I think it means you're a West Wing fan or a member of the Organization of Cartographers for Social Equality.

User avatar
Karilyn
Posts: 282
Joined: Thu Oct 15, 2009 6:09 pm UTC

Re: 0977: "Map Projections"

Postby Karilyn » Mon Nov 14, 2011 7:02 pm UTC

Meng Bomin wrote:http://commons.wikimedia.org/wiki/File:Peirce-quincuncial-projection.jpg

My reason for support of the Peirce Quincuncial is that it displays the continents with relatively little distortion (when centered correctly), it fits into a nice rectangular form, and can be tiled to nice effect. It shows the relationship of the continents relative to the poles in a way that most standard equatorially centered maps don't. [...] Further, in eschewing most maps framing of the world in north-south terms, the Peirce Quincuncial allows for the display of the world without concern for who is "up" or "down" while fitting into a rectangular area. You'll find that the effect is even better if you tile the map.


This map is clearly biased against Antarticans. Let me fix that for you.

Image

(Also made it anti-Euro-American centric for the lulz)

I tried tiling it, and while the effect was attractive, I was irritated the fact that it mirrored across the edges, causing some weird things, most notably showing two Australias next to each other.

Image

You can tile wrong on purpose, with an inaccurately built Antarctica, and avoid this mirroring effect, and it doesn't look bad unless you notice Antarctica is wrong. The tiling wrong on purpose is much more obvious when using my Antartican centered map, where you can very clearly see that Eurasia/Americas are not pieced together properly.

Image

Ultimately there's no way to accurately tile this map, which is disappointing as it is a very visually attractive concept.
Gelsamel wrote:If you punch him in the face repeatedly then it's science.

chrth
Posts: 140
Joined: Tue Mar 17, 2009 4:54 pm UTC

Re: 0977: "Map Projections"

Postby chrth » Mon Nov 14, 2011 7:19 pm UTC

Can someone explain to me why there's such a dispute about Gall-Peters? I read the Wikipedia article, and I understand why cartographers reacted negatively to charges of cultural imperialism, etc., but I don't understand the cartographic reaction to it. What is wrong with it as a map?

fennec
Posts: 2
Joined: Mon Nov 14, 2011 7:21 pm UTC

Re: 0977: "Map Projections"

Postby fennec » Mon Nov 14, 2011 7:31 pm UTC

Disappointed that there's no Transverse Mercator. Doubly disappointed that there's no Transverse Mercator / South Oriented, because it's fun to make fun of South Africa's map systems.

It should first be noted that South Africa has had two official national grids. Prior to 1999 the official national grid was based on the Cape Datum. This datum was referenced to the Modified Clarke 1880 ellipsoid and had its origin point at Buffelsfontein, near Port Elizabeth. This system is variously known as the Cape Datum or LO system. On 1 January 1999 a new national grid became official and this is based on the WGS84 ellipsoid with the co-ordinates of the Hartebeesthoek radio astronomy telescope used as the origin of this system. This new system is known as the Hartebeesthoek94 Datum. Although the new system became official in 1999, eleven years later data using the Cape datum are still being exchanged amongst practitioners. Remembering that ten different central meridians are used with two different datums one will quickly appreciate the complexities encountered due to there being twenty different co-ordinate systems in use in South Africa.


http://trac.osgeo.org/proj/wiki/TMSO

"My, my, I'm getting the idea that being "down under" has drained all the blood from the head to the other end. But the Aussies don't seem to have this problem." -- Gerald Evenden (creator of PROJ)

quantropy
Posts: 194
Joined: Tue Apr 01, 2008 6:55 pm UTC
Contact:

Re: 0977: "Map Projections"

Postby quantropy » Mon Nov 14, 2011 7:38 pm UTC

http://www.cs.ru.nl/~freek/pics/e-map.jpg has a lot going for it. If you're going somewhere, you need more detail the closer you get.

User avatar
Karilyn
Posts: 282
Joined: Thu Oct 15, 2009 6:09 pm UTC

Re: 0977: "Map Projections"

Postby Karilyn » Mon Nov 14, 2011 7:41 pm UTC

chrth wrote:Can someone explain to me why there's such a dispute about Gall-Peters? I read the Wikipedia article, and I understand why cartographers reacted negatively to charges of cultural imperialism, etc., but I don't understand the cartographic reaction to it. What is wrong with it as a map?

The biggest problem with Gall-Peters is that it's a shitty solution in the name of a politically-correct problem which has been solved a dozen different ways without the massive distortion.

There are so many equal area maps that existed before Peter tried to popularize the Gall-Peters, and none of them caused distortion on such an insane scale (I <3 you Goode homolosine for being low distortion of landmass and equal area).

I think it's simply best to keep in mind what purpose a map is used for. Maps like Mercator, while historically useful for navigation, have no business being used in a children's textbook or classroom as a primary map. But neither does a Gall-Peters. Politically-correct loons. Fixing the problem of countries being the wrong size, by distorting them even worse, does not a solution make.

Goode Homolosine, or cube maps are both very easy for to accurately reassemble in the mind and give them a rather accurate representation of the Earth, with an insignificant distortion of size, shape, or distance for education purposes relative to more mainstream maps. While I like Butterfly maps, they are somewhat trickier for a young child to understand.

Image
Last edited by Karilyn on Mon Nov 14, 2011 7:44 pm UTC, edited 1 time in total.
Gelsamel wrote:If you punch him in the face repeatedly then it's science.

barnacle
Posts: 7
Joined: Tue May 17, 2011 7:41 pm UTC

Re: 0977: "Map Projections"

Postby barnacle » Mon Nov 14, 2011 7:43 pm UTC

Jacke wrote:If you are a navigator, you like the good old Mercator! You know about the distortions, but try doing courses, measuring bearings, or doing celestial nav on the others...


You beat me to it. Try plotting a course on, and navigating on any other projection besides mercator. Mercator charts are useful because when you draw a straight line for a course, it intersects every latitude and longitude at the same angle (aka a rhumb line. Easy to steer by compass.)

Randall forgot the trusty Gnomonic projection- Where a straight line drawn on the chart represents a great circle. Handy for working out great circle routes if you aren't feeling like messing with spherical trig today.

User avatar
eran_rathan
Mostly Wrong
Posts: 1840
Joined: Fri Apr 09, 2010 2:36 pm UTC
Location: in your ceiling, judging you

Re: 0977: "Map Projections"

Postby eran_rathan » Mon Nov 14, 2011 7:49 pm UTC

Lambert conical or azimuthal are my preference (mostly because I work in State Plane Coordinate Systems - lat/lon is for posers with navigation grade GPS).


Also, I have a dymaxion icosahedron that NOAA and the NGDC gave out at a conference several years ago.
"Does this smell like chloroform to you?"
"Google tells me you are not unique. You are, however, wrong."
nɒʜƚɒɿ_nɒɿɘ

User avatar
Steve the Pocket
Posts: 704
Joined: Mon Apr 23, 2007 4:02 am UTC
Location: Going downtuuu in a Luleelurah!

Re: 0977: "Map Projections"

Postby Steve the Pocket » Mon Nov 14, 2011 7:54 pm UTC

I remember in elementary school when we were learning about different map projections, and I immediately recognized the Peters projection as the one on the wall in the Sesame Street sketch where Grover was working at a restaurant in an airport. (As seen here.)

And incidentally, Mercator seems like it would be useful if you're making a texture for a 3D model of a globe on a computer since, despite the heavy distortion, the x:y aspect ratio in any given area remains more or less consistently square. You just have to remember to make any labels proportionally bigger towards the top and bottom.
cephalopod9 wrote:Only on Xkcd can you start a topic involving Hitler and people spend the better part of half a dozen pages arguing about the quality of Operating Systems.

Baige.

Farnor
Posts: 1
Joined: Mon Nov 14, 2011 7:52 pm UTC

Re: 0977: "Map Projections"

Postby Farnor » Mon Nov 14, 2011 7:57 pm UTC

The "You use a recently-invented set of gender-neutral pronouns" under the hobo-dyer map might be a reference to this recent dinosaur comic:

http://www.qwantz.com/index.php?comic=2079

I could swear I've seen Randall and Ryan together in pictures.

Also, after years reading the comics and lurking the forums I made an account only to say this.

User avatar
Linux0s
Posts: 247
Joined: Sat Dec 29, 2007 7:34 pm UTC

Re: 0977: "Map Projections"

Postby Linux0s » Mon Nov 14, 2011 8:06 pm UTC

Iulus Cofield wrote:...what projections do Risk and Axis & Allies use?

Axis and Allies uses the elHarris projection which is "Europe needs to be outrageously big to fit all the pieces in".


snoods wrote:On the subject of "south up maps", could you not just get a normal map and, you know, turn it round?

I think the point is to have it south up and still be right reading.
If the male mind truly were a machine it would consist of a shaft and a bushing.

User avatar
PM 2Ring
Posts: 3707
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: 0977: "Map Projections"

Postby PM 2Ring » Mon Nov 14, 2011 8:09 pm UTC

DoMakeSayThink wrote:I'm really surprised nobody has yet suggested the stereographic projection, unless it's given a different name by cartographers. It's definitely my favourite, and it makes the endeavours of Amundsen and Scott all the more impressive (if you project from the south pole).

I don't think it's been mentioned yet in this thread; the closest would be the gnomonic projection, which uses the centre of the sphere as the centre of projection, rather than a point on the sphere's surface. Wikipedia says that another name for stereographic projection is planisphere projection.
I like it because it's conformal. FWIW, I used stereographic projection to create this image:
Image

I rather like the equirectangular projection, for reasons already mentioned. It's very easy to create a Mercator chart from equirectangular data. Also, ray-tracing software can easily wrap an equirectangular map onto a sphere if you want to make globe animations. For that matter, it's not hard to create simple globe animations in JavaScript using the equirectangular projection. Eg,
Spoiler:
This JavaScript / HTML program creates animated globe images from planet and moon map images in equirectangular format. This is the usual format that NASA uses for its map images: a full planet (or moon) image in this format is twice as wide as it is tall. The program can read image files from an Internet URL, or from your hard drive.

The map image data is scaled, blurred and gamma corrected before being orthogonally projected. The projection function uses no interpolation, so it runs reasonably fast, but the downside is that the resulting image is a bit "sparkly", especially on the left & right edges. This can be alleviated by playing with the scale of map image data, and by the use of blurring.

For security reasons, your browser may not allow scripts to access the pixel data of images on the local hard drive, or on domains different from the domain where the script is hosted. If that is the case, your browser should pop up a dialog asking you to give it explicit permission. The original version of this script doesn't do anything dodgy; obviously I can make no claims about any modified scripts that are built from it...

Code: Select all

<!DOCTYPE html>
<html>
<head>
<title>Globe</title>
<meta http-equiv="Content-Script-Type" content="text/javascript">
<style type="text/css">
body{ background-color: #404040 }
h4, hr, a {color: #fa8 }
p { color: #ff8 }
p.centered{ text-align: center }
span {font-size: large; color: #fa8 }
th, h3 { text-align: center; font-size: large; color: #fa8 }
input { width: 90px; }
table { color: #ff8;
 border: solid;  border-color: #fa8
}

</style>
<script type="text/javascript">
var srcMap, mapname =
    //'images/EarthColour_2048.jpg',
    'http://maps.jpl.nasa.gov/pix/jup0vss1.jpg',
    srcpix, octx, ocanvasData, pixels,
    iwidth, iheight, owidth, oheight,
    rad = 180, iscale = 1.25,
    blur = 0.65, gamma = 0.75,
    delay = 50, delta = 0, ddelta = 1, go = false, timeout;

function byId(id) { return document.getElementById(id); }

//Create a canvas element
function make_canvas(w, h)
{
    var c = document.createElement('canvas');

    c.setAttribute('width', w);
    c.setAttribute('height', h);
    return c;
}

//Do Gaussian blurring from src image / canvas into canvas context ctx.
// Mixing ratio: 0 <= r <= 1. 0=Not blurred, 1 = fully blurred
function drawBlurredImage(ctx, src, r)
{
    ctx.globalAlpha = 1 - 12*r/16;
    ctx.drawImage(src, 0, 0);
    if (r == 0)
        return;

    ctx.globalAlpha = 2*r/16;
    ctx.drawImage(src, -1, 0); ctx.drawImage(src, 1, 0);
    ctx.drawImage(src, 0, -1); ctx.drawImage(src, 0, 1);

    ctx.globalAlpha = 1*r/16;
    ctx.drawImage(src, -1, -1); ctx.drawImage(src, 1, -1);
    ctx.drawImage(src, -1, 1); ctx.drawImage(src, 1, 1);
}

// Get canvas pixel data from context ctx
function get_pixels(ctx, ox, oy, w, h)
{
    try
    {
        try
        {
            //Attempt to read canvas data
            var imgd = ctx.getImageData(ox, oy, w, h);
        }
        catch (e)
        {
            //Ask user to give us permission to read canvas data
            netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead");
            var imgd = ctx.getImageData(ox, oy, w, h);
        }
    }
    catch (e)
    {
        var msg = "Unable to access Canvas image data: " + e;

        alert(msg);
        throw new Error(msg);
    }
    return imgd;
}

function init()
{
    set_inputs();
    init_globe();
}

function init_globe()
{
    owidth = 2 * rad; oheight = owidth;
    iheight = Math.floor(iscale * oheight);
    iwidth = 2 * iheight;

    init_ocanvas();
    init_image();
}

function init_ocanvas()
{
    var ocanvas;

    //Set up display canvas
    ocanvas = document.getElementById('outcanvas');
    if (!ocanvas.getContext)
        return alert("Sorry, I can't set up the canvas!");

    ocanvas.width = owidth;
    ocanvas.height = oheight;

    octx = ocanvas.getContext('2d');
    octx.fillStyle = "rgba(64,64,64, 255)";
    octx.fillRect(0, 0, owidth, oheight);
    ocanvasData = get_pixels(octx, 0, 0, owidth, oheight);
    pixels = ocanvasData.data;
}

//Load source map image & wait for image to finish loading before proceeding
function init_image()
{
    //Load globe lat-long map
    srcMap = document.createElement('img');
    srcMap.src = mapname;
    srcMap.onload = init_map;
}

function init_map()
{
    var i, tmpCanvas, tmpCtx, srcCanvas, srcCtx;
   
    //var sc = Math.max(iwidth / srcMap.width, iheight / srcMap.height);

    //Scale source image to final size
    tmpCanvas = make_canvas(iwidth, iheight);
    tmpCtx = tmpCanvas.getContext('2d');
    tmpCtx.scale(iwidth / srcMap.width, iheight / srcMap.height);
    tmpCtx.drawImage(srcMap, 0, 0);

    //Create the source canvas
    srcCanvas = make_canvas(iwidth, iheight);
    srcCtx = srcCanvas.getContext('2d');

    //Do Gaussian blurring on scaled source image
    drawBlurredImage(srcCtx, tmpCanvas, blur)

    //Get pixel data from scaled blurred source map
    srcpix = get_pixels(srcCtx, 0, 0, iwidth, iheight).data;

    if (gamma != 1.0)
    {
        function do_gamma(p) { return Math.floor(255*Math.pow(p/255, gamma)); }

        //On each pixel, do gamma correction
        for (i=0; i<srcpix.length; i+=4)
        {
            srcpix[i] = do_gamma(srcpix[i]);
            srcpix[i+1] = do_gamma(srcpix[i+1]);
            srcpix[i+2] = do_gamma(srcpix[i+2]);
        }
    }
    draw();
}

//Project from lat-long form to orthographic
function draw()
{
    var i, j, ko, ki, u, v, r, pi = Math.PI,
    y, oy = oheight / 2, oy2 = oy * oy, ox = owidth / 2;

    for (j=0; j<oheight; j++)
    {
        y = j - oy;
        v = Math.floor(iheight * (0.5 + Math.asin(y / oy) / pi));
        r = Math.floor((Math.sqrt(oy2 - y*y)));
        for (i=1-r; i<r-1; i++)
        {
            u = Math.floor(iwidth * (2 - 0.5 * Math.acos(i/r) / pi) - delta) % iwidth;
            ki = 4 * (u + iwidth * v)
            ko = 4 * (ox + i + owidth * j);
            pixels[ko++] = srcpix[ki++];
            pixels[ko++] = srcpix[ki++];
            //pixels[ko++] = srcpix[ki++];
            pixels[ko] = srcpix[ki];
        }
    }
    octx.putImageData(ocanvasData, 0, 0);
    delta = (delta + iwidth + ddelta) % iwidth;
}

function timer()
{
    if (go)
    {
        draw();
        timeout = window.setTimeout("timer()", delay);
    }
}

//Toggle timer
function pause()
{
    if(go = !go)
    {
        timer();
        byId('ipause').value = "Pause";
    }
    else
    {
        window.clearTimeout(timeout);
        byId('ipause').value = "\xA0Play\xA0\xA0";
    }
}

//Set input value fields from Javascript global vars
function set_inputs()
{
    byId('ipause').value = "\xA0Play\xA0\xA0";
    byId('imap').value = mapname;
    byId('irad').value = rad;
    byId('iiscale').value = iscale;
    byId('iblur').value = blur;
    byId('igamma').value = gamma;
    byId('idelay').value = delay;
    byId('iddelta').value = ddelta;
}

//Update Javascript global vars from input value fields
function update()
{
    //Pause while changing vars
    go = true;
    pause();

    mapname = byId('imap').value;
    rad = byId('irad').value - 0;
    iscale = byId('iiscale').value - 0;
    blur = byId('iblur').value - 0;
    gamma = byId('igamma').value - 0;
    delay = byId('idelay').value - 0;
    ddelta = byId('iddelta').value - 0;

    delta = 0;
    init_globe();
    pause();
}

</script>
</head>
<body onload="init();">
<p class="centered">
<canvas id="outcanvas">
If you can read this, your browser does not support the HTML5 Canvas.
</canvas>

<p>
<input type="button" id="ipause" onclick="pause();">

<table>
<th colspan="4">Parameters</th>
<tr> <td> Map    <td colspan="3"> <input type="text" id="imap" style="width: 260px"> </tr>
<tr> <td> Radius <td> <input type="text" id="irad">
 <td> Scale  <td> <input type="text" id="iiscale"> </tr>
<tr> <td> Blur   <td> <input type="text" id="iblur">
 <td> Gamma  <td> <input type="text" id="igamma"> </tr>
<tr> <td> Delay  <td> <input type="text" id="idelay" onchange="delay=this.value-0">
 <td> Delta  <td> <input type="text" id="iddelta" onchange="ddelta=this.value-0"> </tr>

<tr> <td colspan="2"> <input type="button" id="update" value="Update" onclick="update();"> </tr>
</table>

<hr>

<h3>Globe</h3>
<h4>by PM 2Ring</h4>
<p>
This JavaScript / HTML program creates animated globe images from planet and moon map images in equirectangular format. This is the usual format that NASA uses for its map images: a full planet (or moon) image in this format is twice as wide as it is tall. The program can read image files from an Internet URL, or from your hard drive. The map image data is scaled, blurred and gamma corrected before being orthogonally projected. The projection function uses no interpolation, so it runs reasonably fast, but the downside is that the resulting image is a bit "sparkly", especially on the left &amp; right edges. This can be alleviated by playing with the scale of map image data, and by the use of blurring.<br><br>

For security reasons, your browser may not allow scripts to access the pixel data of images on the local hard drive, or on domains different from the domain where the script is hosted. If that is the case, your browser will pop up a dialog asking you to give it explicit permission. The original version of this script doesn't do anything dodgy; obviously I can make no claims about any modified scripts that are built from it...<br><br>

The image processing &amp; display utilizes the HTML5 Canvas element, so it may not work on older browsers.<br>

<h4>Parameters</h4>
<p>
<span>Map:</span> The URL or file name of the equirectangular map image file, which should be a JPEG, PNG, or GIF file (or any other format your browser can display directly). If you wish to use a local file, you can give its name relative to the directory you are running this script from, or you can give the file name in absolute form by specifying the name as a file:// URL. The default value for this parameter is a JPL / NASA URL for a map of Jupiter; there are various other maps in the <a href="http://maps.jpl.nasa.gov/pix/">same directory</a>.<br><br>

<span>Radius:</span> The radius (in pixels) of the globe image.<br><br>

<span>Scale:</span> This controls the scaled size of the source map, relative to the globe image: a scale of 1 makes the map the same height as the globe. A scale around 1 gives the best results. If the scale is too large, the globe will be too sparkly; if it's too small, the globe will get pixelated. The scale also controls the speed that the globe turns: the larger the scale, the slower the rotation.<br><br>

<span>Blur:</span> How much blurring to apply. 0 = no blurring, 1 = maximum blurring.<br><br>

<span>Gamma:</span> Gamma correction factor. This affects the brightness of the image. Gamma values less than 1 make it brighter, greater than 1 make it darker. Gamma must be greater than zero.<br><br>

<span>Delay:</span> The time delay between frames, in milliseconds, not counting processing time. The default of 50 should be adequate. If you try to speed it up or slow it down too much the resulting animation may be jerky.<br><br>
<span>Delta:</span> The rate that the globe spins. This parameter can be negative to reverse the direction of spin.<br><br>

When you change the parameters to new values, hit the Update button to tell the program to regenerate the data with the new values. The delay & delay parameters can be modified without using the Update button (just hit enter after changing the value), but changes to the other parameters require the map data to be recalculated; the Update button allows you to change multiple parameters without the calculations being redone for every single change.<br><br>

To keep this program as simple and compact as possible, there is NO error checking performed on any parameter values entered, so if you enter weird values outside the acceptable range, expect weird results. :)<br>

<hr>

</body>
</html>

mcv
Posts: 50
Joined: Tue Nov 03, 2009 8:52 am UTC

Re: 0977: "Map Projections"

Postby mcv » Mon Nov 14, 2011 8:10 pm UTC

I have to admit I didn't know the names of these projections off the top of my head, other than Mercator and the globe, obviously. I did know many of these exist.

But honestly, I think any map that deforms landmasses the way Hobo-Dyer, Gall-Peters, Plate-Caree and even Robinson and Winkel-Tripel do, is rubish. Mercator isn't so bad, in comparison. Sure, it messes with distances, but at least shapes stay fine, and I don't really mind zooming in on obscure corners of the earth. Also it reminds me of a game I used to play as a kid. But of course I prefer a real globe or unfolded icosahedron.

I also like Asimov, and used to like XML until I discovered it sucks (JSON is far superior in most real world cases), I think shoes with toes are an awesome idea for people who run and never ever meet me (I'm a cyclist), the Segway was a stupid idea to begin with (bikes are far better), I do have some 3D glasses from a movie visit, but I'd prefer to own glasses that project an image directly onto my retina. I might switch to Dvorak if somebody was able to prove that it had any benefit whatsoever.

Despite my objections to highly deformed maps, I do buy organic and am conflict-averse, I'm no fan of cultural imperialism, but have never heard of Gall-Peters. Gender neutral pronouns would be great if they occurred naturally, but invented ones are always stupid.

All the other descriptions mean nothing to me. I suspect on the whole I might be a Dimaxion man, though.

xmrsmoothx
Posts: 49
Joined: Tue Feb 09, 2010 10:37 pm UTC

Re: 0977: "Map Projections"

Postby xmrsmoothx » Mon Nov 14, 2011 8:26 pm UTC

Sinusoidal?
I LOVE having a signature. It makes my post that much bigger.

User avatar
Frankie
Posts: 40
Joined: Tue Mar 04, 2008 7:12 pm UTC
Contact:

Re: 0977: "Map Projections"

Postby Frankie » Mon Nov 14, 2011 8:35 pm UTC

chrth wrote:Can someone explain to me why there's such a dispute about Gall-Peters? I read the Wikipedia article, and I understand why cartographers reacted negatively to charges of cultural imperialism, etc., but I don't understand the cartographic reaction to it. What is wrong with it as a map?

Cartographically, all of the rectangular equal area maps (Behrman, Gall-Peters, Hobo-Dyer, Lambert, etc) are identical except for their X-Y ratios.

The dispute is with loud supporters of Arno Peters, who falsely claimed that theirs was the only equal area map, and all other projections are racist. This generated a lot of backlash, including today's XKCD. Here's a decent overview although it downplays the bad pervasiveness of Mercator on public walls.

Luckily, fans of equal area maps have many nice options, such as my favorites, elliptical or interrupted Mollweide.

User avatar
IllvilJa
Posts: 8
Joined: Wed Mar 11, 2009 8:39 pm UTC
Location: Stockholm

Re: 0977: "Map Projections"

Postby IllvilJa » Mon Nov 14, 2011 8:38 pm UTC

...how did Randall know I was typing in Dvorak?!?

(Still trying to recover from the shock of being that easy to predict...)

(But no toe-shoes on my feet, luckily. And the Butterfly projection is a nice one as well in my eyes... Freeciv on that one for heaven's sake!)

ebwolf
Posts: 1
Joined: Mon Nov 14, 2011 8:41 pm UTC

Re: 0977: "Map Projections"

Postby ebwolf » Mon Nov 14, 2011 8:46 pm UTC

FYI: This is now hung on the cube of the unfortunate student employee in the Center of Excellence in GIScience at the US Geological Survey who had to enter John Snyder's entire Bibliography of Map Projections into WikiIndx: http://usgs-ybother.srv.mst.edu/snyder/wikindx3/

See also: http://pubs.er.usgs.gov/publication/pp1395

superluser
Posts: 16
Joined: Wed Aug 17, 2011 5:36 am UTC

Re: 0977: "Map Projections"

Postby superluser » Mon Nov 14, 2011 9:05 pm UTC

My projection is by the Michelin tire company. Somehow, it managed to have two New Zealands (and it's not in the mirror image area of the Robinson).

I do not like it and am seriously considering one of those myriahedrals.

Edit: Actually, it *is* in that area:

http://www.betterworldbooks.com/micheli ... 10716.aspx

But while I understand why you do that in the northern hemisphere, there's no excuse for not trimming that off of the bottom.

User avatar
VoronX
Posts: 57
Joined: Wed Jan 12, 2011 6:05 pm UTC
Location: Washington, DC

Re: 0977: "Map Projections"

Postby VoronX » Mon Nov 14, 2011 9:45 pm UTC

I prefer a 9-12 lobed interrupted sinusoidal. (like on this page: http://www.progonos.com/furuti/MapProj/Dither/ProjInt/projInt.html)
Though, of course, that led me to the myriahedral paper that has now been about posted so often. The problem is that the more lobes you have, with say, the cylindical version, the more it starts looking like the traditional projections.
I still can't believe that Molleweide, sinusoidal or Hammer weren't included as options. Also, This is xkcd, so I expected to see Werner cordiform or Bonne. Sentimentalists <3 Werner projections! http://en.wikipedia.org/wiki/Werner_projection
A humble Pilgrim0 awash in the Sea1 of TimeS, unstuck, observing the wonderful Stars therin . . . waiting for IT.
0 - Billy
1 - BIG
S - Like a River2?

2 - small, and a host of other adjectives

User avatar
Pfhorrest
Posts: 5392
Joined: Fri Oct 30, 2009 6:11 am UTC
Contact:

Re: 0977: "Map Projections"

Postby Pfhorrest » Mon Nov 14, 2011 10:16 pm UTC

Karilyn wrote:
Pfhorrest wrote:Pacific-centered reverse transverse Mercator, purely for aesthetic reasons. It's nice having that solid base of land at the bottom, two branches of it jutting up like pillars on either side, and Australia tossed up in the middle, Indonesia its contrail as it arcs away from south Asia...


I want a link :P


Here's one hacked together from a Wikipedia image, unfortunately it has the ugly grid overlay on it too:

800px-Utm-zones.jpg


(Non-transverse) Mercator works acceptably as well, so here's a Pacific-centered Mercator turned south-up:

map-of-the-world-with-latitude-and-longitude.jpg


Really the projection doesn't matter to me so much, so long as it's a fair (i.e. not politically-motivated) projection and actually shows the whole surface instead of cutting off Antarctica like so many do (including that Mercator I found to turn upside-down). I just like the look up south-up and Pacific-centered maps. I'd kind of like to see a circular Van der Grinten south-up and Pacific-centered.
Forrest Cameranesi, Geek of All Trades
"I am Sam. Sam I am. I do not like trolls, flames, or spam."
The Codex Quaerendae (my philosophy) - The Chronicles of Quelouva (my fiction)


Return to “Individual XKCD Comic Threads”

Who is online

Users browsing this forum: No registered users and 33 guests