# Proj4 work with grdproject problem

**URL:** <https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394>\
**Category:** Q&A\
**Created:** [April 19, 2020, 3:52am UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394 "2020-04-19T03:52:56Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)\
**Post date:** [April 19, 2020, 3:52am UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/1 "2020-04-19T03:52:56Z")

</div>

Hello:  
when run this code:

`gmt grdproject AP_14636_FBD_F6850_RT1.dem.grd -J"+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs +to+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" -C -F -Gtest123.grd`

it will run forever and not return a result,why ?  
I try to convert utm grid to wgs84 geodetic coordinates.  
When I use this command:

`gmt grdproject AP_14636_FBD_F6850_RT1.dem.grd -Ju-58/1:1 -C -Fe -I -GAP_14636_FBD_F6850_RT1.dem_Geodetic.grd`

it can return a good look result,but also return an Error:  
`ERROR 1: PROJ: proj_create: Error -13: major axis or radius = 0 or not given`

I browsed and it seemed to be caused by PROJ4,Thanks a lot!please help!

---

<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 19, 2020, 6:14pm UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/2 "2020-04-19T18:14:28Z")

</div>

When I experiment with synthetic data I get this

```auto
gmt grdmath -R162/168/-10/0 -I0.1 X Y MUL = lixo.grd

gmt grdproject lixo.grd -J"+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs" -Glixo_utm.grd

gmt grdproject lixo_utm.grd -I -J"+proj=utm +zone=58 +south +datum=WGS84 +units=m +no_defs" -Glixo_geo2.grd
First opt_R 164.000000000000/166.000000000000/-6.007148010123/-4.007148010123 1.71944e+09 3.71911e+08
Second opt_R 161.953987660797/-10.013533960436/168.046012339203/0.000000000000r
grdproject [WARNING]: Unknown conversion between GMT and GDAL ellipsoid names. Using a generic spherical body.

```

I find that warning worrisome and don’t get it why it’s complaining.

Your example also hangs for me (but it’s computing something).

---

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)\
**Post date:** [April 20, 2020, 6:45am UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/3 "2020-04-20T06:45:27Z")

</div>

Thanks for reply,I turned a another way,and it work well.

> gdalwarp -t\_srs EPSG:4326 -s\_srs EPSG:32758 AP\_15059\_FBS\_F6860\_RT1.dem.tif AP\_15059\_FBS\_F6860\_RT1\_Geodetic.dem.tif

As above,I use gdal directly,but I also want to konw why gmt return an error.

---

<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 20, 2020, 11:04am UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/4 "2020-04-20T11:04:47Z")

</div>

I will try to debug the source of that error message when I have time.

---

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)\
**Post date:** [April 20, 2020, 1:33pm UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/5 "2020-04-20T13:33:28Z")

</div>

When I use gdalwarp,it can’t deal with the data in irreagular area.  
The data in utm projection:

 ![Snipaste_2020-04-20_21-28-08](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/627665a40a425e8062c81e02fa532e28dfc4e4e9.png)  
When I use gdalwarp(`gdalwarp -t_srs EPSG:4326 -s_srs EPSG:32758 source.tif aim.tif`)to get geodetic coordinates in WGS84:  
 ![Snipaste_2020-04-20_21-27-54](https://canada1.discourse-cdn.com/flex047/uploads/gmt/original/1X/4d1e2dc31631d90193d4bd4c5d4b0bd67b7fa224.png)  
Anyway,Thank you！Joaquim！

---

<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 20, 2020, 7:50pm UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/6 "2020-04-20T19:50:13Z")

</div>

Strange that gdalwarp behavior. Note, your case is simple to do with the GMT syntax only. It should be something around (not sure how to set the suthern hemisphere (-Ju58S/1:1 ?)

```auto
gmt grdproject -I -C -F -R162/168/-10/0 -Ju-58/1:1 ...

```

---

<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 22, 2020, 12:12pm UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/7 "2020-04-22T12:12:55Z")

</div>

@Mark I fixed the ellipsoid names issue (it was a silly bug while comparing text strings), but the other one is tougher. Possibly related to this [https://github.com/GenericMappingTools/gmt/issues/3147](https://github.com/GenericMappingTools/gmt/issues/3147)

---

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)\
**Post date:** [April 23, 2020, 1:45pm UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/8 "2020-04-23T13:45:31Z")

</div>

Thanks a lot，Joaquim！

---

<div class="post-metadata">

**Author:** ![Mark](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@Mark](https://forum.generic-mapping-tools.org/u/Mark)\
**Post date:** [April 23, 2020, 1:53pm UTC](https://forum.generic-mapping-tools.org/t/proj4-work-with-grdproject-problem/394/9 "2020-04-23T13:53:54Z")

</div>

and another question:[Why after grdblend ,the grid spacing changed?](https://flint.soest.hawaii.edu/t/why-after-grdblend-the-grid-spacing-changed/413)  
Hope help! Big Thanks!
