ASFHyP3 / hyp3-lib

Common library for HyP3 plugins
BSD 3-Clause "New" or "Revised" License
14 stars 11 forks source link

asf_geometry.geometry_geo2proj returns incorrect coorindates under GDAL >= 3 #229

Open asjohnston-asf opened 3 years ago

asjohnston-asf commented 3 years ago

GDAL 3 requires PROJ 6, which updates the order for lat/lon coordinates in certain projections:

https://gdal.org/tutorials/osr_api_tut.html#crs-and-axis-order

Under gdal 3, lat/lon should be reversed for TransformPoint() at https://github.com/ASFHyP3/hyp3-lib/blob/develop/hyp3lib/asf_geometry.py#L486:

>>> from hyp3lib.asf_geometry import geometry_geo2proj
>>> geometry_geo2proj(60.44066740331063, 58.097257795794754, -145.429408241755, -150.72504174034862)
(6, 0.0, inf, inf, inf, inf)
>>> coordTrans.TransformPoint(-145.429408241755,58.097257795794754)
(inf, inf, inf)
>>> coordTrans.TransformPoint(58.097257795794754, -145.429408241755)
(592579.4722058995, 6440615.582391564, 0.0)
rudigens commented 3 years ago

So far for backwards compatibility. Classic. Nice catch.