This site contains excerpts and examples of topics covered in the book. Available Now at Pragmatic Bookshelf!!
[View Contents] [Forum]
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:

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.
Recent comments
2 weeks 3 days ago
2 weeks 3 days ago
2 weeks 6 days ago
18 weeks 2 days ago
35 weeks 4 days ago
36 weeks 3 days ago
42 weeks 3 days ago
1 year 16 weeks ago
1 year 17 weeks ago
1 year 26 weeks ago