# Convert latitude longitude grid to x Y grid in meters

**URL:** <https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669>\
**Category:** Q&A\
**Tags:** gmt\
**Created:** [February 12, 2023, 10:06pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669 "2023-02-12T22:06:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyushether](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/piyushether/32/87_2.png) [@piyushether](https://forum.generic-mapping-tools.org/u/piyushether)\
**Post date:** [February 12, 2023, 10:06pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/1 "2023-02-12T22:06:48Z")

</div>

Hi, I am trying to convert my file containing latitude, longitude, and parameter value into x y in meters.  
I tried `mapproject,` but I am not sure whether it provides the correct output or not. My data are in 0.025 x 0.025-degree spatial resolution.

`gmt mapproject latlon.txt $r -Jm0.025 > xy.txt`

Later, I converted my file into a grid file using `xyz2grd` and tried to use `grdproject,` but the story was the same.

`gmt grdproject latlong.nc $r -Jm0.025 -Gnxy.nc`

It will be very much appreciated if I will get some suggestions on it.

---

<div class="post-metadata">

**Author:** ![Andreas](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@Andreas](https://forum.generic-mapping-tools.org/u/Andreas)\
**Post date:** [February 12, 2023, 10:41pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/2 "2023-02-12T22:41:41Z")

</div>

Long shot: try to add `-C -F` to those commands.

---

<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:** [February 12, 2023, 10:46pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/3 "2023-02-12T22:46:09Z")

</div>

Yes, you are not plotting at x cm/degree you know; you want a scale 1:1 to do meters.

---

<div class="post-metadata">

**Author:** ![piyushether](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/piyushether/32/87_2.png) [@piyushether](https://forum.generic-mapping-tools.org/u/piyushether)\
**Post date:** [February 12, 2023, 11:10pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/4 "2023-02-12T23:10:47Z")

</div>

That’s mean I should follow

`gmt mapproject latlon.txt $r -Jm0.025/1:1 -C -F > xy.txt`

`gmt grdproject latlong.nc $r -Jm0.025/1:1 -Gnxy.nc -C -F`

Are both correct?

---

<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:** [February 12, 2023, 11:23pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/5 "2023-02-12T23:23:40Z")

</div>

Why don’t you use the much simpler **-J\<proj4\_string\>** variant?

---

<div class="post-metadata">

**Author:** ![piyushether](https://yyz1.discourse-cdn.com/flex047/user_avatar/forum.generic-mapping-tools.org/piyushether/32/87_2.png) [@piyushether](https://forum.generic-mapping-tools.org/u/piyushether)\
**Post date:** [February 12, 2023, 11:31pm UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/6 "2023-02-12T23:31:55Z")

</div>

> [@Joaquim](#):
>
> -J\<proj4\_string\>

I am sorry @Joaquim but I didn’t get you. I am using `-Jm`. Are you suggesting different?  
could you please elaborate?

---

<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:** [February 13, 2023, 12:00am UTC](https://forum.generic-mapping-tools.org/t/convert-latitude-longitude-grid-to-x-y-grid-in-meters/3669/7 "2023-02-13T00:00:19Z")

</div>

See the manual f **-J**. At the end it explains and has examples on how to use the proj4 syntax.
