ASCII art map of the World: different point of view
I have great appreciation for importance of different points of view ever since my student times in AIESEC organization.
In my previous blog I showed how to produce the ASCII map from world shapes loaded into SAP HANA. The Earth is shown the way we used to see it on maps. And by “we” I mean us living in Europe – in the middle of the universe, thanks to the Greenwich being a prime meridian.
But it was not always be like that. The Greenwich Meridian as the international standard for zero degrees longitude has been agreed at The International Meridian Conference held in 1884. Before that different nations had their own reference systems. I used to live in the capital of Poland not far from the Warsaw meridian monument, which was erected 4 years before the conference.
Looking even further into the ancient times – before America was known to people in Eurasia. Then the center of the world was somewhere around Arabian Peninsula, like on this Ptolemy’s world map from c. 150 (source: Wikipedia). By the way, the most significant contribution of Ptolemy’s maps is the first uses of longitudinal and latitudinal lines!
Even today not all maps use Greenwich as their middle line. While living in Silicon Valley I discovered some America-centric maps. They made absolute sense for me by showing proximity of Asia to California – something that is not that obvious when looking at the Eurocentric maps.
The center of such maps was defined by either 75° West (which is close to Washington meridians) or by 98° West (which is close to the geographic center of the contiguous United States).
(source: 1-World Globes & Maps)
So, I need to make my ASCII map calculation procedure more flexible. Here is the
ASCII_MAP_FLAT_FLEX SQLScript procedure I came up with. Comments and suggestions for improvements are welcome!
create procedure "NATURAL_EARTH"."ASCII_MAP_FLAT_FLEX" (IN resolution INT, IN primeMeridian FLOAT DEFAULT 0.0, IN northUp INT DEFAULT 1) LANGUAGE SQLSCRIPT AS loopLon, loopLat, calcLon, calcLat FLOAT; meridianShift INTEGER; stringSurface, pointSurface STRING; BEGIN IF northUp <> 1 THEN northUp := -1; END IF; if resolution > 1000 THEN resolution := 1000; END IF; IF resolution < 20 THEN resolution := 20; END IF; loopLat := 90; WHILE loopLat>=-90 DO loopLon := -180; calcLat := loopLat * northUp; stringSurface := ''; WHILE loopLon<=180 DO calcLon := loopLon * northUp; select new st_point('POINT ('||:calcLon||' '||:calcLat||')', 1000004326).ST_CoveredBy(SHAPE) into pointSurface FROM "NATURAL_EARTH"."NE_EARTH"; stringSurface := concat (stringSurface, pointSurface); loopLon := loopLon+360/resolution; END WHILE; meridianShift := mod(primeMeridian*northUp +360, 360) * resolution/360; stringSurface := concat (right(stringSurface, resolution-meridianShift), left(stringSurface, meridianShift+1)); INSERT INTO "NATURAL_EARTH"."DRAW_EARTH" VALUES (:calcLat, :stringSurface); loopLat := loopLat-360/resolution; END WHILE; END;
Now, when calling the procedure you can define the meridian, which defines the center of the ASCII map. Here for the map with Washington meridian as prime (parameter
TRUNCATE TABLE "NATURAL_EARTH"."DRAW_EARTH"; CALL "NATURAL_EARTH"."ASCII_MAP_FLAT_FLEX"(RESOLUTION => 180, primeMeridian => -75); SELECT replace(replace("SSTRING", '0', ' '), '1', '*') as "ASCIIMAP" FROM "NATURAL_EARTH"."DRAW_EARTH";
And the result is:
Last year I had a chance to visit Australia for the first time. Being down under helped me to discover the story of McArthur’s “Universal Corrective Map of the World“. In a nutshell the story is “Who told you the North pole is on the top, and not on the bottom of the Earth?” Have you ever asked the same question?
(source: Of maps and math and Buckminster Fuller)
That’s why in the procedure above I introduced as well an optional parameter
northUp. By default is it equal to
1, meaning the north is on top. Any other value will produce a map with the South pole being up. So, let’s have a look at the world from the perspective of my Australian colleagues.
TRUNCATE TABLE "NATURAL_EARTH"."DRAW_EARTH"; CALL "NATURAL_EARTH"."ASCII_MAP_FLAT_FLEX"(RESOLUTION => 180, primeMeridian => 158, northUp => 0); SELECT replace(replace("SSTRING", '0', ' '), '1', '*') as "ASCIIMAP" FROM "NATURAL_EARTH"."DRAW_EARTH";
As well the prime meridian has been set to 158° East to make it Australia-centric.
Want to find how world looks like when you home is the center of the Earth? Just try this code above and play with other parameters 🙂
Or read the next part, if interested in non-rectangular projections.
-Vitaliy, aka @Sygyzmundovych