# GMT in Windows

**URL:** <https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561>\
**Category:** Q&A\
**Created:** [December 21, 2022, 8:08pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561 "2022-12-21T20:08:37Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![AGBatte](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AGBatte](https://forum.generic-mapping-tools.org/u/AGBatte)\
**Post date:** [December 21, 2022, 8:08pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/1 "2022-12-21T20:08:37Z")

</div>

Hello, My name is Arthur and I am new on this platform.  
It has been a while since i used GMT. I am aware a lot has changed since then.  
I learnt GMT using the Windows environment. I am not well informed about other platforms. Recently, I resumed using GMT in windows using my old setup files i had saved. However, I faced some challenge which I hope i could acquire assistance from this forum. I had downloaded a grid file (DEM). The range extent of the grid is 25.0/39:59:30/-5.0/10.0. When i run the script below. I see that the grid doesnt effect the settings of the range i defined

 ![Map](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/f/fac3f0762a521162d4ab97deaa7ac0fa3fdddb20.jpeg)

I wrote the script below

@echo off  
set psfile=maps.eps  
set farbe=-Ccolour\_table.cpt  
set range=-R29.4/32/-0.3/5  
set proj=-JM18

grdraster 1 range -Gtopo.grd -I0.5m -V  
grdfilter topo.grd -Gfiltered.grd -D1 -Fc0.1 -V  
grdgradient filtered.grd -A360 -Gtopo.shd -Nt0.5 -V  
grdimage filtered.grd farbe -Itopo.shd range proj -X2.00 -Y5.0 -Ei -K -P -V \> psfile

pscoast range proj -N1/2p/255,.- -X0.0 -Y0.0 -Bpa0.5f0.1 -Lf29.70/1.10/0.1/50k -Df -Ir/5/150/200/255 -C150/200/255 -O -K -V \>\> psfile

---

<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:** [December 21, 2022, 8:46pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/2 "2022-12-21T20:46:49Z")

</div>

For a simple experiment you could do this:

1. Remove the **grdraster** , **grdfilter** and **grdgradient** commands
2. Let the **grdimage** command simply be

`grdimage @earth_relief_30s %farbe% -I+nt0.5+a360 %range% %proj% -X2.00 -Y5.0 -Ei -K -P -V > %psfile%`

You can experiment with a even higher resolution topography data by checking out the [documentation](https://docs.generic-mapping-tools.org/6.4/datasets.html).

---

<div class="post-metadata">

**Author:** ![AGBatte](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AGBatte](https://forum.generic-mapping-tools.org/u/AGBatte)\
**Post date:** [December 21, 2022, 10:32pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/3 "2022-12-21T22:32:46Z")

</div>

Thanks for the response. I have removed the grdraster, grdfilter and grdgradient commands and it seemed to be running well but then i got the message  
grdimage: Could not find file [+nt0.5+a360]

 ![msg](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/3/34ccbdfbfb8f56fe1c2fcc4e98b0b21f01fd4165.jpeg)  
I am not sure what went wrong

---

<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:** [December 21, 2022, 11:36pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/4 "2022-12-21T23:36:31Z")

</div>

> [@AGBatte](#):
>
> I am aware a lot has changed since then.

Well, yes … and nothing (the GMT paradox 🙂)

> [@AGBatte](#):
>
> I learnt GMT using the Windows environment.

There is nothing OS specific on GMT. Be it on Windows or the others, nothing changes in this regard.

> [@AGBatte](#):
>
> Could not find file [+nt0.5+a360]

Because you typed it, you left a space between **-I** and _+nt0.5+a360_

---

<div class="post-metadata">

**Author:** ![AGBatte](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AGBatte](https://forum.generic-mapping-tools.org/u/AGBatte)\
**Post date:** [December 22, 2022, 5:22pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/5 "2022-12-22T17:22:30Z")

</div>

Hello,

I am sure i did not leave any space between -I and +nt0.5+a360 as you see in the code below. It still gives me the same error message. I placed the earth\_relief\_30s.grd file in the same directory with this batch file, could that have any effect or am i supposed to place them in some other directory? or it is with the settings of the environment. another question, when it is running, why does it take some time before it completes?

@echo off  
SET GMTHOME=C:\programs\gmt6  
SET HOME=C:\programs\gmt6  
SET LIB=%LIB%;%GMTHOME%\LIB  
SET PATH=%PATH%;%GMTHOME%\BIN;

set psfile=maps.eps  
set farbe=-Ccolour\_table.cpt  
set range=-R29.4/32/-0.3/2.5  
set proj=-JM18

grdimage earth\_relief\_30s.grd %farbe% -I+nt0.5+a360 %range% %proj% -X2.00 -Y5.0 -K -P -V \> %psfile%

---

<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:** [December 22, 2022, 5:45pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/6 "2022-12-22T17:45:02Z")

</div>

To keep it simple, just do -I+d for now (I may be wrong on the other syntax).  
No need to place any data anywhere. GMT downloads in the background and assembles the grid needed. Takes some time first time but fast later.  
Keep the name as given: @earth\_relief\_15s, always with the leading @. But to get a crude plot quickly try 06m instead.

---

<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:** [December 22, 2022, 5:47pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/7 "2022-12-22T17:47:34Z")

</div>

> [@AGBatte](#):
>
> I am sure i did not leave any space between -I and +nt0.5+a360 as you see in the code below.

Yes but thing is what is written in the post message and the other is what is actually run 🙂

As Paul said, keep your example simple and without all those variables. This works fine for me and does more or less the same thing

```auto
grdimage @earth_relief_06m -I+nt0.5+a360 -R29.4/32/-0.3/2.5 -JM16 -png lixo

```

---

<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:** [December 22, 2022, 5:51pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/8 "2022-12-22T17:51:24Z")

</div>

We are talking of **which GMT version**?

---

<div class="post-metadata">

**Author:** ![AGBatte](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@AGBatte](https://forum.generic-mapping-tools.org/u/AGBatte)\
**Post date:** [December 25, 2022, 11:24pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/9 "2022-12-25T23:24:43Z")

</div>

Thank you very much. I am getting a grasp of this version bit by bit. It is in fact better than the old versions. but I still have some issues. Like how to shift the make to positions i prefer. You can see that it is shifted to the bottom left, cutting part of the text. and there is alot of space above and right of it. I have looked around but failed to find a solution. Kindly assist.

set range=-R29.5/35/-1/4  
set proj=-JM18  
set farbe= -Cgraycolour\_table.cpt

gmt begin maps eps  
gmt grdcut @earth\_relief\_01m range -Gtopo\_map.nc  
gmt grdimage topo\_map.nc range proj -I+d farbe -Ei --FONT\_ANNOT\_PRIMARY=9p  
gmt pscoast range -N1/1.5p,.- -Ba0.5f0.5 -Df -Ir/5/150/200/255 -W0.5p -BWSen+tKibiro -S150/200/255 -Lg31/0.05+w100+f+u --FONT\_ANNOT\_PRIMARY=12p  
gmt end show

 ![New](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/2X/1/13c914b187a9597823a11a4e49eda792b98f898c.jpeg)

---

<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:** [December 26, 2022, 1:19am UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/10 "2022-12-26T01:19:53Z")

</div>

Again, please don’t obfuscate the script with needless variables. Try this

```auto
gmt begin maps
	gmt grdimage @earth_relief_01m -R29.5/35/-1/4 -JM18 -I+d -Cgraycolour_table.cpt -Ei --FONT_ANNOT_PRIMARY=9p
	gmt pscoast -N1/1.5p,.- -Ba0.5f0.5 -Df -Ir/5/150/200/255 -W0.5p -BWSen+tKibiro -S150/200/255 -Lg31/0.05+w100+f+u --FONT_ANNOT_PRIMARY=12p
gmt end show

```

---

<div class="post-metadata">

**Author:** ![Esteban82](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/esteban82/32/54_2.png) [@Esteban82](https://forum.generic-mapping-tools.org/u/Esteban82)\
**Post date:** [December 26, 2022, 12:35pm UTC](https://forum.generic-mapping-tools.org/t/gmt-in-windows/3561/11 "2022-12-26T12:35:00Z")

</div>

> [@AGBatte](#):
>
> You can see that it is shifted to the bottom left, cutting part of the text. and there is alot of space above and right of it.

I think this is because you selected and eps format. If you use a raster format (like png), then the size of your final image is adjusted to the map (i.e. the white areas are cut).
