Skip to content

Commit 76d9b7b

Browse files
committed
Add lonlat_to_3D prefer lon,lat,height coord order
Keep old function for back compatibility
1 parent 5c6e1b9 commit 76d9b7b

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/accessvis/earth.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,32 @@ def paste_image(fn, xpos, ypos, out):
222222
out[yoff : yoff + col.shape[1], xoff : xoff + col.shape[0]] = col
223223

224224

225-
def latlon_to_3D(lat, lon, alt=0):
225+
def lonlat_to_3D(lon, lat, alt=0):
226226
"""
227227
Convert lat/lon coord to 3D coordinate for visualisation
228228
Uses simple spherical earth rather than true ellipse
229229
see http://www.mathworks.de/help/toolbox/aeroblks/llatoecefposition.html
230230
https://stackoverflow.com/a/20360045
231231
"""
232-
return latlon_to_3D_true(lat, lon, alt, flattening=0.0)
232+
return lonlat_to_3D_true(lon, lat, alt, flattening=0.0)
233233

234234

235-
def latlon_to_3D_true(lat, lon, alt=0, flattening=1.0 / 298.257223563):
235+
def latlon_to_3D(lat, lon, alt=0, flattening=0.0):
236236
"""
237-
Convert lat/lon coord to 3D coordinate for visualisation
237+
Convert lon/lat coord to 3D coordinate for visualisation
238+
239+
Provided for backwards compatibility as main function now reverses arg order of
240+
(lat, lon) to (lon, lat)
241+
"""
242+
return lonlat_to_3D_true(lon, lat, alt, flattening)
243+
244+
245+
def lonlat_to_3D_true(lon, lat, alt=0, flattening=1.0 / 298.257223563):
246+
"""
247+
Convert lon/lat coord to 3D coordinate for visualisation
248+
Now using longitude, latitude, altitude order for more natural argument order
249+
longitude=x, latitude=y, altitude=z
250+
238251
Uses flattening factor for elliptical earth
239252
see http://www.mathworks.de/help/toolbox/aeroblks/llatoecefposition.html
240253
https://stackoverflow.com/a/20360045

0 commit comments

Comments
 (0)