Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

ASCII art map of the World: the polar azimuthal equidistant projection

Sorry for the title. It sounds so smart, I could not resist… I would not know its meaning without the corresponding article in Wikipedia.

In my previous blog I used the simplest Projection of the Earth: cylindrical with constant intervals of meridians and parallels. Therefore it was quite simple to transform the data in the relational columnar table of SAP HANA. Later I learned that projection had smart name too: equirectangular.

This time I am going to produce the azimuthal equidistant projection from the North Pole as a center. This projection has distances from the center conserved. You might have seen it many times, as it is being used in the United Nations emblem:

Source: Wikipedia

The UN’s emblem shows our planet visible from the above of the North Pole, but then flattening the Earth making areas beyond the equator still visible up to the 70° South parallel.

I wanted to the the Ascii Art Map of the same with the difference of going all the way to 87° South to add the ring of a land of Antarctica surrounding all other continents. Greenwich meridian 0° is looking down.

This projection was somewhat bigger challenge for my grey matter transforming the Cartesian coordinate system of loaded shape files into the polar coordinate system of the azimuthal projection and then recalculating it back into the Cartesian system of SAP HANA relational table is not something I have been doing daily since closing the university door behind me. And you see, I had fun coming up with formulas by my own.

But it worked out, and here is a SQLScript procedure. The input data is still the same as in previous blogs.

 loopX, loopY, calcLon, calcLat FLOAT;
 stringSurface, pointSurface STRING;
    loopY := -resolution;
    WHILE loopY= -87
                select new st_point('POINT ('||:calcLon||' '||:calcLat||')', 1000004326).ST_CoveredBy(SHAPE) into pointSurface FROM "NATURAL_EARTH"."NE_EARTH";
                pointSurface := 0;
            END IF;
            stringSurface := concat (stringSurface, pointSurface);
            loopX := loopX+1;
        END WHILE;
        INSERT INTO "NATURAL_EARTH"."DRAW_EARTH" VALUES (:loopY, :stringSurface);
        loopY := loopY+1;

And so executing it…

SELECT replace(replace("SSTRING", '0', ' '), '1', '*') as "ASCIIMAP" FROM "NATURAL_EARTH"."DRAW_EARTH";

…gave me exactly what I’ve been looking for!

I am happy and excited. Are you?

-Vitaliy, aka @Sygyzmundovych

PS. What is interesting, is that – like was shown in my previous blog – prime meridian here is arbitrary. And history has different examples. Including those used as a proof that Earth is flat.

Source: Boston Public Library

This post first appeared on Web Service Testing A Blackjack GUI And API, please read the originial post: here

Share the post

ASCII art map of the World: the polar azimuthal equidistant projection


Subscribe to Web Service Testing A Blackjack Gui And Api

Get updates delivered right to your inbox!

Thank you for your subscription