/Map-Projections

A suite of programs to create custom maps of the Earth's surface.

Primary LanguageJavaMIT LicenseMIT

Map-Projections

A class to create custom maps of the Earth's surface. There are thousands of combinations of color-schemes, projections, and aspects. Includes Mercator, Gall-Peters, Orthographic, Peirce Quincuncial, and More!

Installation

If you are a fancy Windows user, I recommend the convenient fancy Windows binaries. Double-click to install them and then keep pressing buttons until something good happens. If you see a map, you're in the right place.

If you are not on Windows or are otherwise not fancy enough to deserve such executables, simply double-click on the .jar files in the main directory and, if you have Java installed (10/10 would recommend), it should just run without any set-up. Sometimes Windows is weird and you have to use the command line; idk. Ask the internet how to run .jar files if you need help.

You could also compile and run the source code, but if you do, there are a few dependencies. The Java dependencies can be obtained as .jar files:

If you want to use the Python, you'll need a couple of packages from PyPI. Just install Python 3 and pip, and then call the following from a command line (or use Anaconda or something, I don't know. Up to you).

pip3 install numpy pyshp

generate_coastlines.py also takes input data from naturalearthdata.com, which should be placed in src\\zupplemental\\data\\.

How to use

There are three executable Java files, four runnable Java scripts, and four runnable Python scripts. These are, in order:

  • MapDesignerRaster.jar – The original program. Create custom oblique raster images of the Earth's surface using a variety of algorithms called projections.
  • MapDesignerVector.jar – The same idea, but working in vector images instead in case you want to cut a vinyl sticker or something.
  • MapAnalyzer.jar – See graphs and figures quantifying the amount of scale and angular distortion present in each map projection.
  • MapPlotter.java – Plot a large group of map projections by the amount of distortion they produce.
  • MapOptimizer.java – Run gradient descent on parametric projections to minimize their distortion.
  • MapExplainer.java – Generate an HTML blurb outlining and displaying every map projection.
  • MapConverter.java – Generate a bunch of maps in one projection from a bunch of input images.
  • generate_coastlines.py – Generate an SVG string outlining the continents, islands, and major lakes of the world, to be used as vector input.
  • generate_graticule.py – Generate an SVG string displaying a map graticule, to be used as vector input.
  • generate_indicatrices.py – Generate an SVG string outlining an array of Tissot's indiatrices of distortion, to be used as vector input.
  • generate_orthodromes.py – Generate a mesh of orthodromes in an Equirectangular projection, to be used as vector input.

The executable applications all have similar layouts that let you select an input equirectangular map, a projection, an aspect (where the North Pole is situated with respect to the map), and parameters if applicable. Go crazy! There are a practically unlimited number of combinations.

I will note that while I think the interface is mostly intuitive, there are a couple of things where I never got around to making the proper GUI elements, so you won't be able to figure out on your own. The first is the fact that the graticule checkbox, available on Map Designer Raster, draws its formatting information from a file called graticule.txt in the input folder. If you're fine with the default styling, or if you don't use that checkbox, don't worry about it. But if you do use that checkbox, know that you can alter the color and width of the lines by editing that file.

The twoth is the existence of truncated inputs. If you load an input map with the word "octant" in the filename (all lowercase), then the program will load it into the octant bounded by 0°N, 90°N, 0°E, and 90°E. This is useful if you have very large inputs and/or memory constraints. The output will still be sized as though the entire map were there, unless it's a projection that doesn't show the entire globe ("Cahill–Keyes (single octant)" does not show the entire globe and is in fact specifically designed to work with this feature.)

The runnable scripts just kind of work on their own. Those ones aren't really meant for mass consumption.

Wherefore?

I'll write a little blurb here later.

For some examples, check out the output folder. For more information, go to jkunimune15.github.io/Map-Projections.

Credits

While I wrote all of the code in this repository myself, and I created several of the simpler images from scratch, other people did help. Here's a comprehensive list.