Drawing Maps in Mathematica

I thought I’d take a shot at drawing some maps because maps are cool, right?

We used to use CountryData[] to get the coordinates (which needed to be flipped so the image wouldn’t end up sideways) of the borders of each country to draw them. Because we are not barbarians, we will use GeoGraphics[] to draw each country.

Basic Principles

Entering the command by itself will give you an image of your location. For example:

drawingmaps1

…an image of Southern California! And you can change the styles of the maps by using the GeoBackground option. Use “StreetMapNoLabels” instead of “StreetMap” if you do not want bloated letters floating on your map.drawingmaps8.png

Fancier Techniques

GeoGraphics[] has many more sophisticated capabilities. Before I jump in, here’s a link to all of my code. I used to following variables.

drawingmaps2

We can plot several countries at once. Here’s a map with Canada, the United States, and Mexico. Color any country by using FaceForm[<replace bolded with color>]; colors do not need quotation marks. I recommend using EdgeForm[Black] because the colors tend to be light due to their opacity. You can tamper with the opacity and make them solid masses on the map, but then you will not be able to see the background as easily. For some reason, Alaska and Hawaii are excluded in the United States’ polygon data for GeoGraphics[].

drawingmaps3

We can make the map even fancier by putting the flags of each country on their designated locations. Instead of individually importing each flag, use area[“Flag”] to retrieve the image and superimpose it on the map with GeoStyling[].

If you want more demonstrations of flag maps, check out this official page from Wolfram.

drawingmaps4

It looks great, but it’s just a smidgen away from perfection. Shall we replace the flags with more appropriate images?

drawingmaps5

Muahahaha! There is no escape from current events, even on this obscure corner of the internet. This is a joke, by the way. Please do not take this seriously.

Celestial Bodies

To drown out my worries about the future of my country, let’s shift gears to something more exciting: astronomy. You can’t go wrong with outer space!

Unfortunately, Mathematica has limited functionality when it comes to drawing maps of outer space. I mean, relative to what it can do with other things. It is still possible to make awesome space maps. How about this comparison of the Moon’s Webb Crater and the Manicouagan Reservoir in Quebec? (P.S. GraphicsRow is great if you have multiple images and want to set them to the same size.)drawingmaps6

I know, the second image looks like some kind of lunar pimple more than a crater. It’s a common optical illusion, making it easy to think that the Moon has many mountains. The Manicouagan Reservoir is what’s left of a crater formed by a 5 km asteroid. The significantly more unstable weathering  conditions on Earth have clearly produced an impact on the two craters.

The Moon is the most detailed celestial body you can create maps of in Mathematica, excluding the Earth. For example, try getting a picture of Jupiter’s moon Europa:

drawingmaps7

Not looking to hot. Zooming in only yields a pixelated mess. That’s because we have very few close up images of Europa and we have not explored it too much (yet). I hope we will one day be able to send satellites there to see what lies in Europa’s vast oceans. Who knows what we’ll find there, living or not?

drawingmaps9

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s