In our previous GMT examples we used a single command to create a simple globe and create an annotated map. In this example we will create a base map and then use the overlay feature of GMT to plot the location of volcanoes throughout the world.

Suppose you want to extract features from a vector layer to create a smaller subset. This can be very handy if you have a large dataset and need just a portion of it for your current project. If your data happens to be in one of the formats supported by OGR, you can use ogr2ogr to create a new layer.

For this example, we’ll create a map of Alaska and annotate it. If you looked at the Simple Globe example you’ll recall that the -R switch controls the extent of a GMT map. Alaska ranges from about 172 degrees east longitude to 130 degrees west. Using 360 degrees for the entire globe, this translates to a region extending from 172 degrees to 230 degrees. For the Alaska map we will use the Albers Equal Area Conic projection. Looking at the syntax for pscoast reveals that this requires the use of the -Jb switch. In this case, we use the lowercase “b” to indicate that we will specify the size of the map using a scale. First lets look at the command used to create the map:

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

Sometimes you need just a portion of a raster for use in your latest mapping project. In this example we will see a simple way to extract a rectangular region of an image and warp it to the desired projection.