Converting the coordinate system to ECEF and geodesy

When performing satellite positioning calculations such as GPS, it is possible to represent the position on the earth.

--XYZ Cartesian coordinate system defined by ECEF (earth-centered earth-fixed) --Geodetic datum, a method of expressing latitude, longitude, and height

Two are used. The height calculated in the vertical direction from the sphere when the earth is modeled as an ellipsoid is called the "ellipsoid height", and the height from the geoid (corresponding to the average sea level) is called the altitude.

There are many reference materials,

-WGS84 and Coordinate Conversion Story --WikiPedia's Latitude

And so on.

My uncle used to use the library he implemented himself, but when I saw it today, I found a python library, so I'll make a note of it.

Checking the operation of coordinate conversion using pymap3d

pymap3d

--Source available at https://github.com/geospace-code/pymap3d --Registered at https://pypi.org/project/pymap3d/. I was able to install it with pip without any problems.

The desired coordinate transformation function can be found in pymap3d.ecef.ecef2gedetic. As the name suggests.

Operation check

The coordinate value of Tsukuba 1 of the electronic reference point is used.

from math import isclose
from pytest import approx
from pymap3d.ecef import ecef2geodetic

def test_ecef2geodetic():
    x_ecef = [-3957162.4119, 3310203.4927, 3737752.2980]
    x_geod = [36.106112803, 140.08720184, 70.336]
    x_geod_from_ecef = ecef2geodetic(x_ecef[0], x_ecef[1], x_ecef[2])
    print( "x_geod_from_ecef=", x_geod_from_ecef)
    print( "x_geod=", x_geod)
    assert x_geod[0] == approx( x_geod_from_ecef[0] )
    assert x_geod[1] == approx( x_geod_from_ecef[1] )
    assert isclose(x_geod[2], x_geod_from_ecef[2], rel_tol=0.01)

When I do pytest --capture = no -v, a warning appears for some reason, but it was OK.

x_geod_from_ecef= (36.10611280179599, 140.08720184317684, 70.33612007893962)
x_geod= [36.106112803, 140.08720184, 70.336]
PASSED

I will recommend this from now on.

Recommended Posts

Converting the coordinate system to ECEF and geodesy
Terms closely related to the X Window System
Experiment and leave evidence to determine the specifications.
How to identify the system call number ausyscall
Try to simulate the movement of the solar system
[Mac] A super-easy way to execute system commands in Python and output the results
I tried adding system calls and scheduler to Linux
How to use the grep command and frequent samples
Wrap and encapsulate the validation target to prevent complications
[Python] Conversion from WGS84 to plane orthogonal coordinate system
How to use argparse and the difference between optparse
Resize the image to the specified size and blacken the margins
Scraping the member stores of Go To EAT in Osaka Prefecture and converting them to CSV