Creating a Simple “Globe” with GMT

The Generic Mapping Tools (GMT) can be used to create high quality maps for printing or use in web pages or documents.

You can easily create a simple globe (similar to the one on this website) using GMT. Here is the command:
pscoast -JA0/20/2.5i -Bg30/g15 -Dl -A2000 -G187/142/46 -S109/202/255 \
-R0/360/-90/90 -P -N1 > simple_hemi.eps

This produces:

Let’s look at the switches used to create the image. The projection is specified with the -J switch. In our example we used -JA0/20/2.5i. This selects the projection (Lambert Azimuthal Equal Area) and sets the longitude to 0 degrees, the latitude to 20 degrees, and the width of the map to 2.5 inches. Note that either -J or -j can be used. Specifying uppercase indicates that the last parameter (in our case 2.5i) is width. Had we used a lowercase “j”, GMT would interpret the last parameter as a scale value. Widths can be specified using c, i, p, or m which correspond to centimeters, inches, points (1/72 of an inch), and meters. To get a list of the projections available, enter the pscoast command without any arguments.

The -B switch defines the intervals for the boundary tick marks. In the globe case, these are the lines of longitude and latitude. The arguments to the -B switch indicate a gridline spacing of 30 degrees in the x (longitude) direction and 15 degrees in the y (latitude) direction. Note how the x and y settings are separated by a forward slash.

The -D switch selects the resolution of the data set used in creating the globe. The available choices are f, h, i, l, and c which correspond to full, high, intermediate, low, and crude. Some of these options may not be available to you if you didn’t install all the data sets with GMT. For the globe, we used the low resolution data set.

To control the display of features, the -A switch allows you to specify that features below a certain size not be drawn. In our example, we specified that features with an area greater smaller 2,000 square kilometers should not be displayed.

The fill color used for the countries is specified using the -G switch. The color can be specified using RGB notation, a shade of gray, or a pattern can be used. In the globe, we used 187/142/46 to create a light brown color.

The other major switch used in generating the globe is -R. This specifies the extent of the map we want to generate. In the case of the globe, we obviously wanted the entire planet so we specified an x range of 0 to 360 degrees and a y range of -90 to 90. The range is specified as west/east/south/north. In our next example we will use -R to constrain our map to a smaller area.

The other switch of interest is -N1. This tells GMT to draw national boundaries in addition to the coastline. Other arguments to -N allow you to draw state boundaries within the Americas and marine boundaries. The -P switch simply sets the page orientation to portrait. Landscape is the default.

The output is in EPS. You can convert this to other formats in a number of ways. A method that will work on Linux, Mac, and Windows is the ImageMagick convert command:

convert simple_hemi.eps simple_hemi.png

GMT has a lot of commands and options. It’s best to take a good look at the GMT documentation to learn more about the possibilities.

February 8, 2008 · admin · No Comments
Tags:  · Posted in: GMT