# Problems with oblique Mercator projection

**URL:** <https://forum.generic-mapping-tools.org/t/problems-with-oblique-mercator-projection/1310>\
**Category:** Q&A\
**Created:** [February 7, 2021, 12:42am UTC](https://forum.generic-mapping-tools.org/t/problems-with-oblique-mercator-projection/1310 "2021-02-07T00:42:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gito](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/gito/32/209_2.png) [@gito](https://forum.generic-mapping-tools.org/u/gito)\
**Post date:** [February 7, 2021, 12:42am UTC](https://forum.generic-mapping-tools.org/t/problems-with-oblique-mercator-projection/1310/1 "2021-02-07T00:42:11Z")

</div>

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

Garrett

[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 (https://www.generic-mapping-tools.org/team.html).
Supported in part by the US National Science Foundation (http://www.nsf.gov/)
and volunteers from around the world.

GMT is distributed under the GNU LGPL License (http://www.gnu.org/licenses/lgpl.html).
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: [gmrt.marine-geo.org](http://gmrt.marine-geo.org)  
.  
.  
.

[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 \> ! $psfile.ps  
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 \>! $psfile.ps  
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)

 ![image](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/7b0945ade7334a1ca8bf2c89180a1b157a78447b.jpeg)

---

<div class="post-metadata">

**Author:** ![KristofKoch](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/kristofkoch/32/314_2.png) [@KristofKoch](https://forum.generic-mapping-tools.org/u/KristofKoch)\
**Post date:** [February 7, 2021, 7:39pm UTC](https://forum.generic-mapping-tools.org/t/problems-with-oblique-mercator-projection/1310/3 "2021-02-07T19:39:50Z")

</div>

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

> [@gito](#):
>
> `[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 >! $psfile.ps`

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:

`-R[lowerLeftLon]/[lowerLeftLat]/[upperRightLon]/[upperRightLat]+r`

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`](https://docs.generic-mapping-tools.org/latest/gmt.html#r-full).

---

<div class="post-metadata">

**Author:** ![gito](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/gito/32/209_2.png) [@gito](https://forum.generic-mapping-tools.org/u/gito)\
**Post date:** [February 7, 2021, 10:46pm UTC](https://forum.generic-mapping-tools.org/t/problems-with-oblique-mercator-projection/1310/4 "2021-02-07T22:46:58Z")

</div>

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!  
Garrett
