Rendering the World Map Using the Racket Plot Package

submited by
Style Pass
2021-05-23 19:00:07

As part of writing the geoid package, I needed to visualize some geographic projections and I discovered that the 3D plotting facilities in the racket plot package can be easily used for this task. The geoid package and the projection it uses is somewhat complex, so, to keep things simple, this blog post covers the display of the country outlines on a globe loading the data from the GeoJSON file and using only basic plotting facilities.

The image below is rendered entirely using the racket plot package, and it only takes a few lines a Racket code to load the data from a GeoJSON file and display it. You’ll only need a standard Racket installation, with no additional packages, but it does require some creative use of the 3D plot features.

The geographic data that define the outline of continents and countries uses latitude/longitude coordinates, but the racket graph plotting package does not directly understand these coordinates, so we’ll need to decide how to represent the data in a way that it can be plotted.

Leave a Comment