1

I'm trying to convert the (x,y,z) coordinate from a compound CRS to another one. I came across this example online, and it does work for me.

import pyproj

cmpd_crs = pyproj.crs.CompoundCRS(name="WGS 84 + EGM96 height", components=["EPSG:4326", "EPSG:5773"])
trans = pyproj.Transformer.from_crs(cmpd_crs, "EPSG:4979") # epsg 4979 is Geographic 3D CRS 
trans.transform(45, -122, 10)

This reports

(45.0, -122.0, -10.386833190917969)

However, when I tried to do other transformations between compound CRS using EPSG codes, it doesn't work. For example:

import pyproj

c1 = pyproj.crs.CompoundCRS(name="NAD83+cgvd28",components=["EPSG:4617","EPSG:5713"])
c2 = pyproj.crs.CompoundCRS(name="NAD83+cgvd2013",components=["EPSG:4617","EPSG:6647"])

transformer = pyproj.Transformer.from_crs(c1,c2)
transformer.transform(45, -122, 10)

This reports (without any change)

(45.0, -122.0, 10.0)

And

import pyproj

c1 = pyproj.crs.CompoundCRS(name="WGS84 + EGM96", components=["EPSG:4326", "EPSG:5773"])
c2 = pyproj.crs.CompoundCRS(name="NAD83+cgvd2013",components=["EPSG:4617","EPSG:6647"])

transformer = pyproj.Transformer.from_crs(c1,c2)
transformer.transform(45, -122, 10)

This reports (without any change)

(45.0, -122.0, 10.0)

Also

import pyproj

c1 = pyproj.crs.CompoundCRS(name="NAD83+cgvd28",components=["EPSG:4617","EPSG:5713"])

transformer = pyproj.Transformer.from_crs(c1,"EPSG:6649")
transformer.transform(45, -122, 10)

This reports (still without any change)

(45.0, -122.0, 10.0)

Any insights? Thanks a lot!!

Erin Li
  • 185
  • 1
  • 1
  • 6
  • Do you have the transformer grids installed? – snowman2 Jul 08 '20 at 02:37
  • https://pyproj4.github.io/pyproj/latest/transformation_grids.html – snowman2 Jul 08 '20 at 02:37
  • @snowman2 Thank you for the information. However, after I install the transformer grids, I still don't get the transformed coordinate, especially the height. It reminds me that I got a 'HT2_2010v70_CGG2013a.byn' file from the NRCan website [link](https://webapp.geod.nrcan.gc.ca/geod/data-donnees/geoid.php?locale=en), do you have any insights on how would I use this .byn file to transform between vertical datums (CGVD28 and CGVD2013) with pyproj? Thanks a lot. – Erin Li Jul 08 '20 at 18:16
  • How did you install the grids? – snowman2 Jul 08 '20 at 18:22
  • @snowman2 I followed the instruction on [link](https://pyproj4.github.io/pyproj/latest/transformation_grids.html) by using conda install -c conda-forge proj-datumgrid-europe proj-datumgrid-north-america proj-datumgrid-oceania proj-datumgrid-world – Erin Li Jul 08 '20 at 18:25
  • That should work if the grid is there. You may want to look into the PROJ mailing list and see if they have advice. – snowman2 Jul 08 '20 at 23:10

0 Answers0