2

I would like to convert Ellipsoidal height to Orthometric height in Python. I tried below:

import pyproj


EGM2008height = pyproj.Proj("EPSG:3855") 
wgs84_ll = pyproj.Proj("EPSG:4326")
print(pyproj.transform(wgs84_ll, EGM2008height, 34.68016909181368, 38.31245226053967,100))

It gives this error:

> Traceback (most recent call last):   File "bos.py", line 26, in
> <module>
>     EGM2008height = pyproj.Proj("EPSG:3855")   File "C:\Users\abt\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pyproj\proj.py",
> line 151, in __init__
>     super().__init__(cstrencode(projstring.strip()))   File "pyproj\_proj.pyx", line 86, in pyproj._proj._Proj.__init__
> pyproj.exceptions.ProjError: Invalid projection b'+vunits=m
> +no_defs'.: (Internal Proj Error: proj_create: unrecognized format / unknown name)

I deleted 100 (as I use ellipsoidal height) and again same error. Any help?

ayaz alp
  • 21
  • 4
  • In my question, i put code of the answer of previous question and it gave the error. The previous question does not have an answer – ayaz alp Apr 06 '20 at 09:34
  • Which is your line 86? I use pyproj 1.9.5.1 and I have to add init to the EPSG string to work: wgs84_ll = pyproj.Proj(init="EPSG:4326"). There is no EPSG 3855 in my epsg file. Have you tried you transformation using cs2cs command line utility? – Zoltan Apr 06 '20 at 10:28
  • Thank for the reply.. Error in this line.. EGM2008height = pyproj.Proj("EPSG:3855").. But in EPSG website https://epsg.io/3855 there is.. I did not try the cs2cs because I dont know how to? Could you please tell me how can i do it in python? – ayaz alp Apr 06 '20 at 10:33
  • epsg.io isn't the EPSG website for that you want www.epsg-registry.org/, but yes it exists as a valid code ~ http://www.epsg-registry.org/export.htm?wkt=urn:ogc:def:crs:EPSG::3855 – nmtoken Apr 06 '20 at 11:05

1 Answers1

1

Using pyproj 1.9.5.1 the following code works with and without elevation:

wdm = pyproj.Proj(init="EPSG:3857")
wgs = pyproj.Proj(init="EPSG:4326")
print(pyproj.transform(wgs, wm, 34.68016909181368, 38.31245226053967,100))
print(pyproj.transform(wgs, wm, 34.68016909181368, 38.31245226053967))

the result:

(3860578.7639253223, 4623659.355379215, 100.0)
(3860578.7639253223, 4623659.355379215)

I used EPSG:3857 because EPSG:3855 is not in my epsg file.

Zoltan
  • 7,325
  • 17
  • 27
  • My purpose is to convert ellipsoidal height to orthometric height. In the result, it is still 100. Thank you for your help Zoltan – ayaz alp Apr 06 '20 at 11:45
  • As far as I see there is a shift grid in the definition of 3855 (the gtx file). You should give a transformation for the latitude/logitude (easting/northing) and for the height add geoidgrids="egm08_25.gtx" to the transformation. Of course you should download the gtx file. – Zoltan Apr 06 '20 at 11:52