Grid Viewer

Opening Grids

View a GMT grid surface:

using InteractiveGMT, GMT

G = GMT.peaks()
fig = iview(G)

Options

OptionDescription
cmapColormap name (e.g., "relief", "geo", "etc")
veVertical exaggeration (default: 1)
drapeImage to drape over surface
nameName in Scene Objects
shadingEnable PBR lighting (default: true)
edgesShow mesh edges (default: false)

Examples

# With colormap
fig = iview(G; cmap="relief")

# With vertical exaggeration
fig = iview(G; ve=5)

# With image drape
I = gmtread("satellite.tif")
fig = iview(G; drape=I)
MouseAction
Left-dragRotate view
Middle-dragPan
Scroll wheelZoom
Right-clickContext menu

Keyboard: e toggles mesh edges.

Colormaps

Available named colormaps: relief, geo, geo2, dem, mbio, world, Byrne, circular, polar, etc, jet, no_green

fig = iview(G; cmap="my_colors.cpt")  # Custom CPT file

Right-click "Color Bar" in Scene Objects to change colormap interactively.

Hillshade

Illuminate relief like a shaded map:

Menu: View → Hillshade Lambert or Hillshade grdimage

Vertical Exaggeration

fig = iview(G; ve=5)  # 5x vertical exaggeration

Interactively: Drag the blue ring on the gizmo, or use View → Vertical Scale…

Adding Overlays

Add line or point overlays to a live grid:

Line Overlays

# Add coastline
coast = gmtread("coastline.gmt")
add!(fig, coast; mode=:lines, color="black", width=1.5)

Point Overlays

# Add stations
stations = gmtread("stations.txt")
add!(fig, stations; mode=:points, color="red", size=10)

Image Drape

Drape a georeferenced image over the terrain:

# View grid with drape
fig = iview(G; drape=I)

# Or add to existing window
add!(fig, I; drape=true)

Curtains

Hang a vertical seismic profile:

add_curtain!(fig, "seismic.nc"; x=0, rotation=45)

Saving

save_png(fig, "output.png")

Or File → Save Grid / Save Image menu.