python - Can we convert longitude and latitude to cartesian co-ordinates without elevation? -


can convert longitude/latitude (x,y) coordinates cartesian (x,y,z) without having elevation. have checked forms discussing converting longitude/latitude cartesian coordinates, , here's code in python.

    r = numpy.float64(6371000)  # in meters     longitude = numpy.float64(lon)     latitude = numpy.float64(lat)     x = r * math.cos(longitude) * math.sin(latitude)     y = r * math.sin(latitude) * math.sin(longitude)     z = r * math.cos(latitude) 

problem statement: have data gathered different locations. however, these locations in longitude , latitude format. these 2 attributes enough convert locations cartesian format ?. code above correct ?

you need distance center of earth convert latitude+longitude x,y,z (either earth-centered, earth-fixed or earth-centered inertial). earth-centered inertial requires time convert longitude angle.

the reason simple: need 3 independent variables since it's 3d coordinate system. latitude , longitude 2 variables, need distance center (r in equations above) that.

if looking ground coordinates, can use google elevation api r in equations above. either way need information coordinate transform.


Comments