Problems with oblique Mercator projection

Hi Folks, My attempt at an oblique mercator projection is failing. Thanks in advance for your help.


[gito@mahi ~/MOR3d]$ uname -a
Linux mahi 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
gito@mahi ~/MOR3d]$ gmt

GMT - The Generic Mapping Tools, Version 6.1.0 [64-bit] [36 cores]
(c) 1991-2020 The GMT Team (
Supported in part by the US National Science Foundation (
and volunteers from around the world.

GMT is distributed under the GNU LGPL License (
Dependencies: netCDF, ZLIB, Ghostscript, GraphicsMagick, FFmpeg.

Clipperton_med_low.grd: Title: GMRT Grid
Clipperton_med_low.grd: Command:
Projection: Cylindrical Equidistant
Created with GMRT MapTool:

[gito@mahi ~/MOR3d]$ grdinfo Clipperton_med_low.grd
Clipperton_med_low.grd: Remark:
Clipperton_med_low.grd: Gridline node registration used [Geographic grid]
Clipperton_med_low.grd: Grid file format: cf = GMT netCDF format (32-bit float, deprecated)
Clipperton_med_low.grd: x_min: -104.543701172 x_max: -103.297851562 x_inc: 0.00220114771974 name: Longitude n_columns: 567
Clipperton_med_low.grd: y_min: 9.80650356173 y_max: 10.9519782214 y_inc: 0.00216535852488 name: Latitude n_rows: 530
Clipperton_med_low.grd: z_min: -3882.48999023 z_max: -1610.49938965 name: Elevation (m)
Clipperton_med_low.grd: scale_factor: 1 add_offset: 0
Clipperton_med_low.grd: format: classic

gmt grdimage Clipperton_med_low.grd -R-104.5/-103.5/9.8/10.8 -JOA-104/10/100/5 -Ccolors.cpt -Vl -P -Y5 > ! $
grdimage [INFORMATION]: Read header from file Clipperton_med_low.grd
grdimage [INFORMATION]: Spherical approximation used
grdimage [INFORMATION]: Map scale is 22.239 km per cm or 1:2.2239e+06.
grdimage [INFORMATION]: Allocate and read data from file Clipperton_med_low.grd
grdimage (gmtapi_import_grid): Could not reallocate memory [68718660880.46 Gb, 18446525069155548148 items of 4 bytes]
[gito@mahi ~/MOR3d]$
[gito@mahi ~/MOR3d]$ gmt grdimage Clipperton_med_low.grd -R-104.5/-103.5/9.8/10.8+r -JOA-104/10/10/80 -Ccolors.cpt -Vl -P -Y5 >! $
grdimage [INFORMATION]: Read header from file Clipperton_med_low.grd
grdimage [ERROR]: Internal Failure = GMT_MAP_BAD_LAT_MIN
grdimage (GMT_grdimage): South is outside -90 to +90 degree range

This is what is produced using -JX5i (or similarly -JM5i)

Hi @gito not sure what you want to achieve but I see a problem in

Your -R is out of limits there.

-R-104.5/-103.5/9.8/10.8 without +r at the end defines the region of interest from -104.5° longitude to -103.5° longitude and from 9.8° latitude to 10.8° latitude.

Basically -R[minLon]/[maxLon]/[minLat]/[maxLat].

Your adding +r at the end changes the meaning to something different. Now you define the lower left corner and the upper right corner of your region of interest:


So you are providing a lower left coordinate of -104.5° longitude, -103.5° latitude. With latitudes spanning only from -90° to +90° the problem is clear.

Further reading in the docs on -R.

Hi Kristof. Your explanation for the +r command helped me solve the problem. Originally I ran grdimage without the +r option and thats what gave me the memory error. Now I see that when I use +r correctly “-R-104.5/9.8/-103.5/11.0+r” (and -JOA-104/10/80/5i) then it works! I see now that -R without +r changes definition when using -JO/o. Thanks a lot!