TransWikia.com

How to specify geoid grid for `osr.SpatialReference` instance

Geographic Information Systems Asked on April 19, 2021

How can I specify e.g. Geoid 12A or Geoid 18 when (for example) converting NAVD88 orthometric heights to ellipsoid heights using the OSR Python bindings?

Of course I would like to be able to specify any .gtx file that is available to OSR.

A working example would be very much appreciated as I’m still a little unsure of how to make this work. I guess it looks something like this:

from osgeo import osr

# Take NAD83/UTM 15N as an example
src_horz = osr.SpatialReference()
src_horz.ImportFromEPSG(4269)
src_horz.SetUTM(15, True)
# Use NAVD88 vertical datum
src_vert = osr.SpatialReference()
src_horz.ImportFromEPSG(5103)
# Define compound SRS
src_srs = osr.SpatialReference()
src_srs.SetCompoundCS('', src_horz, src_vert)

# Define output SRS
dst_horz = osr.SpatialReference()
dst_horz.ImportFromEPSG(4326)
# Use NAVD88 vertical datum
dst_vert = osr.SpatialReference()
dst_vert.ImportFromEPSG(4979)
# dst_vert.SetVerticalShiftGrid('Geoid 12A') ### How do I do this?
# Define compound SRS
dst_srs = osr.SpatialReference()
dst_srs.SetCompoundCS('', dst_horz, dst_vert)

transform = osr.CoordinateTransformation(src_srs, dst_srs)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP