GMT Map Boundary Configuration and Parameter Customization in Cartographic Visualization

Generic Mapping Tools (GMT) represents a comprehensive software system widely utilized within the geosciences for mapping and plotting geographic data. A critical component of GMT functionality involves the precise control of map boundary frames, axes attributes, and visual elements such as borders, gridlines, and annotations. The system allows users to manipulate default parameter settings to achieve specific cartographic aesthetics, ranging from simple line borders to complex, multi-colored frames. Understanding how to configure these elements is essential for generating publication-quality maps that meet specific stylistic and informational requirements.

GMT operates on a system of default parameters that govern every aspect of map creation. Users can view these defaults by executing the command gmt defaults -D, which outputs a comprehensive list of configurable settings. These parameters control color schemes, font specifications, map frame types, gridline characteristics, and tick mark styles. The primary method for modifying these settings within a script is the gmt set command, which allows for the persistent change of parameter values for subsequent commands. Alternatively, parameters can be adjusted for a single command using the long option syntax --parameter=value.

Map Frame Types and Border Styles

One of the fundamental aspects of map design in GMT is the appearance of the map frame. The MAP_FRAME_TYPE parameter dictates the style of the border surrounding the map. The default setting is fancy, which renders a black-and-white zebra pattern border commonly seen in older cartographic styles. For a more minimalist or modern appearance, users can change this setting to plain. This modification results in a simple, single-line border.

The gmt coast command is frequently used to draw coastlines and political boundaries. The -N option within this command controls the drawing of political boundaries. The syntax -N1/thick,60 indicates that international borders (type 1) should be drawn with a thick pen width and a color index of 60. Other boundary types include -N2 for state boundaries within the Americas and -N3 for marine boundaries. The -D option selects the resolution of the coastline data, with options ranging from f (full) and h (high) to i (intermediate), l (low), and c (crude). The default resolution is l (low) in classic mode and a (auto) in modern mode.

Customizing Fonts and Annotations

GMT provides extensive control over the typography used in maps. The FONT_ANNOT_PRIMARY parameter defines the font for primary grid tick labels, while FONT_TITLE controls the appearance of the map title. Font specifications in GMT follow a string format consisting of three parts: size, style, and color. For example, the setting 30,Bookman-Demi,#0D057A specifies a font size of 30 points, the Bookman-Demi style, and a specific hex color code.

The formatting of geographical coordinates is managed by the FORMAT_GEO_MAP parameter. This parameter uses specific codes to define the display format: d represents degrees, m represents minutes, and s represents seconds. The suffix F is used to append the "NEWS" direction indicator (North, East, West, South) after the value. A common setting for degree-minute formats is dddF, which displays degrees followed by the direction suffix.

The orientation of annotations on the map border can be adjusted using the MAP_ANNOT_OBLIQUE parameter. This parameter accepts a code to control how tick labels are displayed. For instance, code 32 instructs GMT to keep the longitude format unchanged while displaying the latitude vertically along the map border. This is particularly useful for maps with specific projection requirements or to prevent label overlap.

Gridlines and Tick Marks

Gridlines are essential for providing spatial reference on a map. The MAP_GRID_PEN_PRIMARY parameter defines the pen attributes (width, color, and style) for the primary grid lines. For example, thinner,#ED99F0 sets the grid lines to be very thin and colored a specific shade of pink. To enhance visibility, users might override this default within a specific command using the syntax --MAP_GRID_PEN_PRIMARY=thicker.

The MAP_GRID_CROSS_SIZE_PRIMARY parameter controls the size of the cross symbols that may appear at grid intersections, often set in points (e.g., 8p). The MAP_TICK_PEN_PRIMARY parameter defines the pen used for drawing tick marks on the map frame, such as thicker,black.

The spacing of gridlines and annotations is controlled via the -B option in commands like gmt basemap or gmt coast. The syntax -Ba40f20g20 sets the primary annotation interval to 40 degrees (a40), the tick interval to 20 degrees (f20), and the grid line interval to 20 degrees (g20). The -B+tMercator option adds a title ("Mercator") to the map.

Plotting Lines and Paths

GMT's plot command is used to overlay vector data, such as lines and points, onto a map. By default, plot draws the great circle route connecting two points. However, the -A option overrides this behavior, forcing the command to draw a straight path in the projected map system. In a Mercator projection, this straight path corresponds to a rhumb line (a path of constant bearing).

To differentiate between these two types of paths (great circle vs. rhumb line), users can plot the same dataset twice: once with -A for the rhumb line and once without it for the great circle path. Pen attributes can be customized using the -W option (e.g., -W1p,$rl_color), and points can be plotted using symbols such as -Sa0.4c for starred markers.

Background and Page Configuration

The overall appearance of the output image is controlled by several global parameters. The PS_PAGE_COLOR parameter sets the background color of the paper or canvas. For example, setting it to ivory changes the background to a pale yellowish-white. The MAP_TITLE_OFFSET parameter adjusts the distance between the map title and the map frame (e.g., 0.5c for half a centimeter).

GMT also supports the visualization of specific geographic regions through the -E option in gmt coast. This option allows users to paint or dump country polygons based on the Digital Chart of the World dataset, independent of the GSHHG coastline data. Countries can be selected using 2-character ISO 3166-1 alpha-2 codes (e.g., US.TX for Texas) or continent codes (e.g., =NA for North America). Additionally, map direction roses can be added using the -Td option, which requires specifying a reference point, anchor point, and width (e.g., +wwidth).

Conclusion

The Generic Mapping Tools system offers a robust framework for creating detailed and customized cartographic visualizations. By leveraging the gmt set command and specific command options, users can manipulate map boundaries, frame types, fonts, gridlines, and background colors to suit specific analytical or publication needs. Understanding the interplay between default parameters and command-specific overrides is key to efficient map generation. Whether creating simple reference maps or complex multi-layered visualizations, GMT provides the flexibility to control every aspect of the map's appearance.

Sources

  1. GMT Tutorials - Layout Design
  2. CERI Memphis - GMT Data Notes
  3. GMT Documentation - pscoast (v6.1)
  4. GMT Documentation - pscoast (v6.3)

Related Posts