“In this map, Randall Munroe, the creator of celebrated webcomic xkcd, has plotted the world map featuring all the landmasses from both western and eastern hemispheres. But the longitudes west of the prime meridian, normally given negative values from 0° to -180°, have been made positive using the “ABS()” function that gives the absolute value by effectively stripping off the minus sign from any value. This results in the features on one side of the world being overlaid upon those of the other side, but mirrored.” ~ by explainxkcd. Can we make this map with the Wolfram Language?

Introduction

The xkcd 2807 post https://xkcd.com/2807 shows an interesting idea: a map of the world that ignores the sign of longitude. Here is a way to easily implement it with Wolfram Language.

Code

Take the polygon of the world:
pol=Entity["GeographicRegion","World"]["Polygon"];
We get a map like this:
GeoGraphics[{GeoStyling[White],pol},GeoProjection->"Robinson",GeoRange->All,GeoBackground->Gray]
Now take each individual point {lat, lon} and change it to {lat, Abs[lon]}:
apol=pol/.{lat_Real,lon_Real}:>{lat,Abs[lon]};
Show both polygons of the world, restricting to positive longitudes:
GeoGraphics[{GeoStyling[White],pol,apol},GeoProjection->"Robinson",GeoRange->{All,{0,180}},GeoBackground->Gray]

Conclusion

The interesting thing is to use both the original polygon and the “reflected” polygon. There will be a part that gets repeated, but that should not be a problem. The reason to use both polygon instead of just reflected one is that the operation of taking Abs of longitude only changes the boundaries, not the interiors. Therefore we need to still use both pol and apol. Another possibility would be to use {lat_, lon_} :> {lat, -lon}, and the result should be equivalent (we would still need both pol and apol).

CITE THIS NOTEBOOK

Computationally Reproducing the XKCD Comic 2807: Bad Map Projection #152​
by Jose Martin-Garcia​
Wolfram Community, STAFF PICKS, August 31, 2023
​https://community.wolfram.com/groups/-/m/t/3002642