# "Best" projection for rectangular world map?

**URL:** <https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715>\
**Category:** Q&A\
**Created:** [February 27, 2023, 4:24pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715 "2023-02-27T16:24:31Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 18, 2023, 4:25pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/61 "2023-04-18T16:25:57Z")

</div>

Without knowing what you are trying to do …

Maybe this example helps?  
[https://www.generic-mapping-tools.org/GMTjl\_doc/examples/projections/02\_proj\_examples/#oblique\_mercator](https://www.generic-mapping-tools.org/GMTjl_doc/examples/projections/02_proj_examples/#oblique_mercator)

---

<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:** [April 18, 2023, 4:49pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/62 "2023-04-18T16:49:23Z")

</div>

My apologies @Joaquim for not being specific enough:

I’m still struggling with my “global domain wrap around world map”. While I do get your example from [your post above](https://flint.soest.hawaii.edu/t/best-projection-for-rectangular-world-map/3715/51) to work on my machine I fail in moving the central meridian to the east for a better balanced map. See discussion in [my post](https://flint.soest.hawaii.edu/t/best-projection-for-rectangular-world-map/3715/44) above.

So far I toyed around with [proj’s `+pm`](https://proj.org/usage/projections.html#prime-meridian) option but wasn’t able to get it to work properly:

 ![GMTjl_tmp](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/6/6b72a95a26762664461bff93f98d7cf2d7f03054.jpeg)

```
using GMT

cl = coast(dump=:true, res=:crude, region=:global);
cl_right = cl .+ 360;
cl_left = cl .- 360;
cl_vdg = lonlat2xy(cl, t_srs="+proj=vandg +pm=20");
cl_right_vdg = lonlat2xy(cl_right, t_srs="+proj=vandg +over +pm=20");
cl_left_vdg = lonlat2xy(cl_left, t_srs="+proj=vandg +over +pm=20");
tmp = cat(cl_left_vdg, cl_vdg);
cl3_vdg = cat(tmp, cl_right_vdg);

plot(cl3_vdg, show=1) 

```

I highly assume it is only due to my lack of Julia-fu. Maybe you as a Julia guru see my mistake right away?

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 18, 2023, 5:02pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/63 "2023-04-18T17:02:35Z")

</div>

Honestly, I don’t know who to blame here. The projection worked fine but 20 degrees of the Alaska are trimmed out in the West and wrapping lines show up. It’s not impossible that this is proj bug.

---

<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:** [April 18, 2023, 5:40pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/64 "2023-04-18T17:40:59Z")

</div>

Glad you are not blaming me 😉 I’ll investigate further.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 21, 2023, 5:58pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/65 "2023-04-21T17:58:31Z")

</div>

With master, but only if you are not plagued with some building stubbornness and you get a recent date

```auto
julia> GMT.GMTdevdate
2023-04-18

```

You can do

```auto
G = worldrectangular("@earth_relief_30m_g", pm=30, latlim=80);
imshow(G, shade=true)

```

and get (ignore the `ERROR 10: Pointer 'hBand' is NULL in 'GDALGetRasterDataType'.` that started to pop up from I don’t know where nor why).

`? worldrectangular` print the using options

 ![GMTjl_tmp-or8](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/6/6f7269b1d1155b025e0fd00d5f69909224443cbc.png)

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 24, 2023, 1:26am UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/66 "2023-04-24T01:26:41Z")

</div>

```auto
G, cl = worldrectangular("@earth_relief_30m_g", pm=30, latlim=(80,-70), coast=:low);
imshow(G, shade=true, show=false, cmap=:geo)
plot!(cl, show=1)

```

 ![GMTjl_j-or8](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/8/8a754e6fa91419a8d9695500fb46d85718638c5e.png)

I’m thinking in using this example in the GMT.jl paper.

---

<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:** [April 24, 2023, 7:11am UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/67 "2023-04-24T07:11:53Z")

</div>

Back from work – this looks awesome, @Joaquim! I’ll give it a run as soon as I’m done upgrading my number crunching rig. Great work!

---

<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:** [April 24, 2023, 7:59pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/68 "2023-04-24T19:59:45Z")

</div>

Not sure where I messed up:

```
julia> GMT.GMTdevdate
0001-01-01

```

Needs more investigation on my part.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 24, 2023, 9:38pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/69 "2023-04-24T21:38:59Z")

</div>

This is a transition period in GMT.jl where a new method to install GMT is implemented. Basically, just update GMT.jl (`] up`) and things should be solved. Note that after updating the GMT version that GMT.jl use is a Julia own built one and not the one you compile. I have a recipe for those who want to force using the system wide GMT (see [https://github.com/GenericMappingTools/GMT.jl/blob/master/src/GMT.jl#L30](https://github.com/GenericMappingTools/GMT.jl/blob/master/src/GMT.jl#L30)) but the good news is that new GMT installation (that is only visible from Julia) was build with `imagetexture` branch.

---

<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:** [April 25, 2023, 7:05am UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/70 "2023-04-25T07:05:28Z")

</div>

Unfortunately still no joy:

```
julia> GMT.GMTdevdate
0001-01-01

(@v1.8) pkg> up
    Updating registry at `~/.julia/registries/General.toml`
  No Changes to `~/.julia/environments/v1.8/Project.toml`
  No Changes to `~/.julia/environments/v1.8/Manifest.toml`

julia> using GMT

julia> GMT.GMTdevdate
0001-01-01

```

Edit: Julia reports the following version:

```
julia> using Pkg

(@v1.8) pkg> st GMT
Status `~/.julia/environments/v1.8/Project.toml`
  [5752ebe1] GMT v0.44.8
```

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 25, 2023, 11:14am UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/71 "2023-04-25T11:14:36Z")

</div>

This is new stuff in master. Do `] add GMT#master`

---

<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:** [April 25, 2023, 12:10pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/72 "2023-04-25T12:10:54Z")

</div>

Ah, thank you @Joaquim. Now I get

```
julia> GMT.GMTdevdate

2023-04-13

```

which isn’t the date you were showing in your post above.

Running your code:

```
G, cl = worldrectangular("@earth_relief_30m_g", pm=30, latlim=(80,-70), coast=:low);
imshow(G, shade=true, show=false, cmap=:geo)
plot!(cl, show=1)

```

Gives me a plot but not like yours:

 ![GMTjl_kristof](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/0/03f4fa05e7e4cc8e9afaafbdc8483ad53bd447ad.jpeg)

Do I need to invoke the master branch somehow? I did the usual `using GMT` and also tried `using GMT#master`.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 25, 2023, 12:43pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/73 "2023-04-25T12:43:30Z")

</div>

> [@KristofKoch](#):
>
> ```auto
> julia> GMT.GMTdevdate
> 
> 2023-04-13
> 
> ```

That’s fine. It is the date when GMT was built in `BinaryBuilder`. Mine is different because on Windows what is used is the installed GMT (the one I build) or our installer.

I’m having different errors from yours in WSL, which is also quite strange but it seem to indicate that I have non-committed stuff. Well I know I do, but didn’t think it was needed to reproduce this example. I’ll come back when I update with my local changes.

> [@KristofKoch](#):
>
> Do I need to invoke the master branch somehow?

No, just do the usual `using GMT`

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 25, 2023, 1:43pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/74 "2023-04-25T13:43:21Z")

</div>

This is indeed very strange. I updated master but get the same as you in WSL. I wonder if I screw something with the instructions to build GMT in `BinaryBuilder` (Julia stuff) and those GMT binaries are not updated to what it needs for this. The shufflings with bits of the global grid are not even done and we don’t see a full filled rectangular grid.

The only way I see for now on unix is to see if these intended instructions to make use of system wide installed GMT do work.

```auto
# The file deps/deps.jl is created by compile from the deps/build.jl
# On Windows we use a system wide GMT if it is found from path or install it from a GMT installer. It is a MSVC binary.
# On Unix the default is to use the GMT_jll artifact. However this can be changed to use a system wide GMT installation.
# To swap to a system wide GMT installation, do (in REPL):
# 1- ENV["SYSTEMWIDE_GMT"] = 1;
# 2- import Pkg; Pkg.build("GMT")
# 3- restart Julia
#
# Note the above will work up until some other reason triggers a Julia recompile, where the JLL artifacts 
# will be used again. To make the ENV["SYSTEMWIDE_GMT"] = 1 solution permanent, declare a "SYSTEMWIDE_GMT"
# environment variable permanently in your .bashrc (or whatever).

```

But to keep teasing, this is what it was supposed to be possible by now. @pwessel how difficult would it be to let custom annotations have slanted ticks?

 ![GMTjl_j-or8](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/9/9140015391cd82d5d5323837d7539d77f947ac6e.png)

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [April 25, 2023, 1:58pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/75 "2023-04-25T13:58:16Z")

</div>

I am surprised they are not slanted unless **MAP\_OBLIQUE\_ANNOT** has been set or changed (?)

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 25, 2023, 2:33pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/76 "2023-04-25T14:33:48Z")

</div>

They can’t slant because they are custom annotations and as far as they know, they are plotting on a cartesian axis.

---

<div class="post-metadata">

**Author:** ![pwessel](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/pwessel/32/30_2.png) [@pwessel](https://forum.generic-mapping-tools.org/u/pwessel)\
**Post date:** [April 25, 2023, 2:54pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/77 "2023-04-25T14:54:32Z")

</div>

Sure, if this is added as a Cartesian overlay then there are no slanting. I cannot see a simple method to overcome that.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 25, 2023, 4:36pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/78 "2023-04-25T16:36:06Z")

</div>

@KristofKoch, the problem is more serious. The failure in unix is coming from the `gdalwarp` command not doing its job. Unfortunately, there are error messages issued by GDAL that I’ve not been able to capture in the Julia wrapper and maybe this is one of these cases. This makes even more needed to test if my recipe above makes it work.

---

<div class="post-metadata">

**Author:** ![Joaquim](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/joaquim/32/16_2.png) [@Joaquim](https://forum.generic-mapping-tools.org/u/Joaquim)\
**Post date:** [April 25, 2023, 5:32pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/79 "2023-04-25T17:32:15Z")

</div>

It’s a GDAL bug. On Windows this works. It screams a lot but it works (it doesn’t for .nc)

```auto
gdalwarp -t_srs "+proj=vandg +over +pm=30" earth15.grd lixo.tiff

```

but not on linux. It screams equally but doesn’t work  
… unless we repeat the command. Then no screaming and it works. That is, when overwriting it works but not when the file doesn’t exist.

---

<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:** [April 25, 2023, 7:45pm UTC](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715/80 "2023-04-25T19:45:12Z")

</div>

What about inside annotations? Is it possible to have them oriented along meridians and parallels? Or does the same problem apply as with outside annotations?

[Previous page](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715.md?page=3)

[Next page](https://forum.generic-mapping-tools.org/t/best-projection-for-rectangular-world-map/3715.md?page=5)
