Generic Mapping Tools: high quality map production

Submitted by dylan on Fri, 2007-07-13 20:52.

The creation of print quality maps can be a daunting task, especially when a scaleble output format (such as PDF) is required. Fortunately the Generic Mapping tools can be used to transform geographic data into conveniently packaged EPS or PDF files. Link to Perl-GMT example page. Excellent tutorial on grdimage.

Simple unix style commands are used to overlay subsequent layers of geographic information into either a Postscript or an EPS file. An example map consisting of California county boundaries, a hillshade of topography, and GPS points is presented below. the GMT commands required to prepare this map are listed below. Command names are in boldface type, input files are red, and output files are in green. A more detailed example on using data generated with GRASS in GMT can be found here: GRASS Users Group of Davis, CA.

PDF file here
Commands here


An example map created with GMT


GMT Commands:

  • Setup some default parameters for GMT
  • gmtset COLOR_NAN 255/255/255 DOTS_PR_INCH 300 ANNOT_FONT_PRIMARY Times-Roman \
    ANNOT_FONT_SIZE_PRIMARY 10 ANNOT_FONT_SIZE_SECONDARY 10 HEADER_FONT Times-Roman \
    LABEL_FONT Times-Roman LABEL_FONT_SIZE 10 HEADER_FONT_SIZE 10 PAPER_MEDIA letter \
    UNIX_TIME_POS 0i/-1i PS_COLOR CMYK Y_AXIS_TYPE ver_text PLOT_DEGREE_FORMAT DF
  • Create a basemap, with lat/lon tics
  • psbasemap -JB-120/40/34/40.5/7i -R-122/-117.5/34/38.5 -Xc -Yc -B1 -K -P -V > ssc105s.ps
  • Plot the landform raster data with a grayscale color table
  • makecpt -Cgray -T0/255/1 -V > grey.cpt
    grdimage shade.grd=2 -Cgrey.cpt -J -R -K -O -V >> ssc105s.ps
  • Create scale bars in miles and kilometers
  • psbasemap -J -R -Lf-121.5/34.5/34/50k:"Kilometers": -T-120.75/34.25/1.5c -O -K -P -V >> style="color:green;">ssc105s.ps
    psbasemap -J -R -Lf-121.5/34.25/34/50m:"Miles": -O -K -P -V >> ssc105s.ps
  • Plot some vector data: Ca outline, Ca counties, and pit locations
  • psxy counties.xy -M -J -R -W1/100/100/100 -P -O -K -V >> ssc105s.ps
    psxy ca.xy -M -J -R -W3/0/0/0 -P -O -K -V >> ssc105s.ps
    psxy pit_locations.xy -J -R -Sc0.15c -W1/0/0/0 -G0/0/0 -P -O -K -V >> ssc105s.ps
  • Label the pit locations
  • pstext pit_locations.labels -J -R -Dj0.1c/0.1c -G0/0/0 -P -O -K -V >> ssc105s.ps
  • Make a small context map showing the entire state
  • psxy ca.xy -M -JB-120/40/34/40.5/1i -R-124.5/-114/32/42.5 -X0.25i -Y1.5i -W2/0/0/0 -P -O -K -V >> ssc105s.ps
    psxy pit_locations.xy -J -R -Sc0.01c -W1/0/0/0 -G0/0/0 -P -O -K -V >> ssc105s.ps
    psxy zoom_extent.xy -M -JB -R -W1/0/0/0 -P -O -V >> ssc105s.ps

 
Getting Background Raster Data from NASA (From a Lon/Lat Location in GRASS)

  • After setting up the region, get the global mosaic base (true color) map.

    r.in.wms --o -o -p -c layers=global_mosaic_base style=visual \
    mapserver=http://wms.jpl.nasa.gov/wms.cgi output=wms_global_mosaic \
    format=png
  • Simple export to GMT compatible format. Since we are using integer data, and separate R/G/B rasters, the process is very simple:

    r.out.bin -i -h in=wms_global_mosaic.green out=grd_green
    r.out.bin -i -h in=wms_global_mosaic.red out=grd_red
    r.out.bin -i -h in=wms_global_mosaic.blue out=grd_blue
  • Add to a GMT map with:

    grdimage grd_red grd_blue grd_green ...