GMT Notes

Here are some random notes that may help users of GMT (the Generic Mapping Tools), the open source mapping software.

19 August 2007 — getsrtm updated for endian-ness and fractional -R values

getsrtm3 and getsrtm1 are updated now to include an optional flag for byte-swapping on little-endian (e.g. Intel) machines. Look in the CONFIG section at the top of the scripts and uncomment the relevant line, as necessary. (Thanks to Eric Fielding and Roland LaForge for pointing this out.) See below for fuller explanation and download links.

Also, Roland LaForge created some wrappers in C which will allow these scripts to select -R regions with fractional coordinate values:

One limitation to [the getsrtm scripts], however, is that integer values must be used for the lat and lon boundaries. It turns out that perl can't easily parse decimal values from the command line.

Since I usually want to use fractional boundary coordinates, I wrote simple C programs that allow one to input decimal values. They simply call Roy's scripts, then apply grdcut to trim the final.grd file to the input values. The programs are attached below. All they assume is that getsrtm1 and getsrtm3 are in your PATH.

Usage is as follows:

getsrtm1_wrap -a westlon -b eastlon -c southlat -d northlat

The final file is final.grd, as before. If you want to use a region other than "northamerica" in getsrtm3_wrap, change line 29 in the source code to the appropriate region code.

LaForge's wrapper: getsrtm_wrap.tgz (1k gzipped tar file)

3 May 2006 — getsrtm updated

I just updated the getsrtm3 script, as well as all the links below. Everything points to the current SRTM ftp server, as of this writing.

6 April 2005 — scripts to easily obtain SRTM-1 and SRTM-3 data

I am offering two command line utilities written in Perl — getstrm1 and getstrm3 — which I use to selectively download and stitch together SRTM (Shuttle Radar Topography Mission) tiles from the 1-second (30m) and 3-second (90m) datasets, respectively.

These scripts enable you to specify a very simple GMT-style -R flag and then they take care of fetching the tiles, converting them to .grd files, pasting them together and cleaning up after themselves, leaving you with nothing but a single merged .grd file. They will also transparently take care of tiles that don't have any land area (the SRTM dataset doesn't include water-only tiles).

Sample usage:

> getsrtm1 -R-90/-88/30/31

Note that SRTM-1 data (as of this writing) has only been released for the United States. For SRTM-3 data you will additionally have to specify a continent parameter:

> getsrtm3 northamerica -R-90/-88/30/31

The continent parameter is determined by the location of your tiles on the continent map on the SRTM ftp site. You will have to look it up, and if your region of interest falls on a continent boundary then you will have to get your tiles in two passes and merge them yourself with grdpaste.

Other caveats:

Download the two scripts: getsrtm.tgz, (3k gzipped tar file). These files are provided as is. I probably won't have time to answer individual questions, but you can try me anyway.

27 February 2006 : Thanks to Ryan J. Earley for updating the SRTM server machine and path info, which had changed in the meantime. The updated scripts are still in the same tarball, linked above.

15 March 2004 — make sure SRTM entries are spec'd correctly in grdraster.info

I posted a question about processing SRTM data to the GMT-Help mailing list along with this supporting documentation and received quick and helpful responses which I recorded on that page as well.