2

I have a location off of the coast of Madagascar with longitude and latitude:

X = 43.28191425

Y = -22.49701687

This point also has a Z value (height). I want to convert the lat,lon to UTM co-ords and convert the Z value from ellipsoid height to Orthometric height (EGM2008)

I can convert the Z value using:

import pyproj
from pyproj import Proj
from pyproj import Transformer

transformerh = Transformer.from_crs("epsg:4326", "epsg:3855")
Xegm, Yegm, Zegm = transformerh.transform(X, Y, Z)

However, when I try converting the X and Y co-ords to UTM with:

    myProj = Proj("+proj=utm +zone=38, +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs")

    Xutm, Yutm = myProj(X, Y)

it gives me the co-ords:

Xutm = 323263.48408316
Yutm = -2488855.56162304

so the Yutm value is negative and makes no sense for its location, although the Xutm value is correct. The lat and lon point is definitely in UTM zone 38 (South) and when I try the conversion with other software (rsgsilib) it gives me the co-ords:

Xutm_check = 323263.4843173389
Yutm_check = 7511144.4386357535

which match the co-ords in Google Earth.

Am I incorrectly assigning myProj?

3

Your proj string should be "+proj=utm +zone=38 +south +datum=WGS84 +units=m +no_defs" i.e no comma before +south. You can also use the EPSG code

myProj = Proj('+proj=utm +zone=38 +south +datum=WGS84 +units=m +no_defs')
Xutm, Yutm = myProj(X,Y)
print(Xutm, Yutm)

myProj = Proj(32738)
Xutm, Yutm = myProj(X, Y)
print(Xutm, Yutm)


# 323263.484317678 7511144.438617312
# 323263.484317678 7511144.438617312
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.