How to draw a topographic map of the moon in GMT


I am studying GMT software recently, and my recent studies are all about cartography on the earth. I want to know how to use GMT to get some topographic maps and elevation maps of the moon, like the following:

I don’t know how to change the default background of GMT from Earth to Moon.
Looking forward to your reply.


While we have a pending NASA proposal to also supply planetary DEMs, we do not at the moment. You can download moon DEMS and plot them in GMT just like you would any other grid. Using --PROJ_ELLIPSOID= Moon will be helpful as well.


Thanks for your reply.I don’t know how to use GMT very well,so I have two doubts. I hope you can help me.

The first question is what kind of data format GMT supports and how can I read it? The second problem is about "- proj_ Is ellipsoid = moon ".This is to change the default ellipsoid of GMT, I just need to enter “GMT set proj”_ Is the ellipsoid = moon "command OK? Do I have to do this when I deal with lunar elevation data?

Looking for your reply

GMT can read any grid almost, sine we use GDAL for things we dont support natively. Usually, such data might come in a ndfCDRT file or a Geotiff.
In your script you could type
gmt set PROJ_ELLIPSOID moon
to change the default.


I downloaded the DEM of the polar regions of the moon, in tif format.The website is""

When I run the command"
gmt grdimage E:\Mars\LRO_LOLA_DEM_NPolar875_10m.tif -R-180/180/87.5/90 -JA0/90/12c -Baf"
The result is“psconvert [ERROR]: Unable to decode BoundingBox file C:/Users/brightness/.gmt/sessions/gmt_session.5160/ (maybe no non-white features were plotted?) ”

The file cannot be used directly for drawing, how should I adjust the data?

Looking for your reply

If you run gmt grdinfo on that file you will see it is not geographic but probably projected coordinates for a polar projection. You cannot use -JA on a Cartesian file. You should look for a file with longitude,latitudes; I know that exists.


It is indeed a Cartesian coordinate system, not a geographic coordinate system.How can I convert the data to a geographic coordinate system? You said “look for a file with longitude,latitudes”,I am not sure what this document refers to? Can you guide me further?I really appreciate your help

Looking for your reply


Plotting maps of other planets is cool. Here’s a script to do it (sorry if the formatting is a bit messed up). Hack it to your heart’s content :smiley: I cannot remember where I found the data file; search for the file name of the GeoTiff file.

#!/usr/bin/env bash
# Plot lunar map

# Convert the GeoTiff file to geographical NetCDF file. Then convert it to a coarser resolution for plottting.
if [[ ! -e moon.grd ]]
        gmt grdproject Lunar_LRO_LOLA_Global_LDEM_118m_Mar2014.tif -Gmoon.grd \
                -I -JQ0/0/10916406.15 -C -Rd -V

if [[ ! -e coarsemoon.grd ]]
        gmt grdsample moon.grd -Gcoarsemoon.grd -I0.5/.05 -Rd

gmt begin map pdf,png A+m1c
        gmt gmtset FONT_ANNOT_PRIMARY    10p,Helvetica,black
        gmt gmtset FONT_LABEL                        14p,Helvetica,black
        gmt gmtset FONT_TITLE                         18p,Helvetica,black
        gmt gmtset FORMAT_GEO_MAP            dddF
        gmt gmtset MAP_ANNOT_OBLIQUE      15
        gmt gmtset MAP_ANNOT_OBLIQUE      15
        gmt gmtset PROJ_ELLIPSOID                moon
        gmt gmtset PROJ_LENGTH_UNIT           c

        gmt grdimage coarsemoon.grd -Cbathy -JR30 -Rd -B+t"Lunar Topography" \
        -Bpxyf10a30g30 -Q -I+d
        gmt plot -Wthick,red <<- END
        -90     0
        0               90
        90      0
        0               -90
        -90     0
  gmt colorbar -DJBC+w15/0.25+h -Bpxf500a2000 \
    -Bpx+l"Elevation (m)"
gmt end

1 Like