I wrote this code to convert geodetic coordinates to cartesian. It asks for user input and it prints x, y and z.
The code runs without any errors, but after putting the inputs, the print function does not show the value of x.
What would be the issue here?
Thank you for your help.
import math
a = 6378137
f= 0.00335281068
latitude = math.radians(float(input('Enter Latitude:')))
longitude = math.radians(float(input('Enter Longitude:')))
height = float(input('Enter Height:'))
def earthConverter(latitude, longitude, height):
N = a / math.sqrt(1-e**2 * math.sin(longitude)**2)
e = math.sqrt((2 * f) - (f**2))
x = (N + height) * math.cos(longitude) * math.cos(latitude)
y = (N + height) * math.cos(longitude) * math.sin(latitude)
z = (N * (1 - (e**2) ) + height) * math.sin(latitude)
return x, y, z
earthConverter(123.0256, 56.45648, 21322.4545)
print('x is %f' % x)