Skip to main content

Geographic system transformations with helper functions

Project description

transforms84

PyPI - Version PyPI - Python Version Codecov PyPI - License

Python library for geographic system transformations with additional helper functions.

This package focuses on:

  1. Performance
  2. Ideal mathematical shapes of (NumPy) matrices: (3,1) or (nPoints,3,1). Shapes (3,) and (nPoints,3) are also supported.
  3. Functions that adapt to differing input matrices shapes: one-to-one, many-to-many and one-to-many points. See below for an example.

Installation

pip install transforms84

Operations

Coordinate Transformations

The following coordinate transformations have been implemented:

Velocity Transformations

The following velocity transformations have been implemented:

  • ECEF โ†’ NED
  • NED โ†’ ECEF
  • ENU โ†’ ECEF
  • ECEF โ†’ ENU

Distances

The following distance formulae have been implemented:

Additional Functions

The following functions have been implemented:

  • Angular difference (smallest and largest)
  • [rad, rad, X] โ†’ [deg, deg, X]
  • [deg, deg, X] โ†’ [rad, rad, X]

Examples

See the Jupyter notebooks in examples to see how to use the transform84. Run pip install transforms84[examples] to run the examples locally.

Many-to-many & one-to-many

The transforms.ECEF2ENU transformation accepts same and differing matrix shape sizes. Below showcases the many-to-many method where three target points, rrm_target, in the geodetic coordinate system are transformed to the local ENU coordinate system about the point rrm_local, where both matrices are of shape (3, 3, 1):

>> import numpy as np
>> from transforms84.systems import WGS84
>> from transforms84.helpers import DDM2RRM
>> from transforms84.transforms import ECEF2ENU, geodetic2ECEF
>>
>> rrm_local = DDM2RRM(
>>     np.array(
>>         [[[30], [31], [0]], [[30], [31], [0]], [[30], [31], [0]]], dtype=np.float64
>>     )
>> )  # convert each point from [deg, deg, X] to [rad, rad, X]
>> rrm_target = DDM2RRM(
>>     np.array(
>>         [[[31], [32], [0]], [[31], [32], [0]], [[31], [32], [0]]], dtype=np.float64
>>     )
>> )
>> ECEF2ENU(
>>     rrm_local, geodetic2ECEF(rrm_target, WGS84.a, WGS84.b), WGS84.a, WGS84.b
>> )  # geodetic2ECEF -> ECEF2ENU
array(
    [
        [[4.06379074e01], [-6.60007585e-01], [1.46643956e05]],
        [[4.06379074e01], [-6.60007585e-01], [1.46643956e05]],
        [[4.06379074e01], [-6.60007585e-01], [1.46643956e05]],
    ]
)

We can achieve the same result using the one-to-many method with a single local point of shape (3, 1):

>> rrm_local = DDM2RRM(np.array([[30], [31], [0]], dtype=np.float64))
>> ECEF2ENU(rrm_local, geodetic2ECEF(rrm_target, WGS84.a, WGS84.b), WGS84.a, WGS84.b)
array(
    [
        [[4.06379074e01], [-6.60007585e-01], [1.46643956e05]],
        [[4.06379074e01], [-6.60007585e-01], [1.46643956e05]],
        [[4.06379074e01], [-6.60007585e-01], [1.46643956e05]],
    ]
)

World Geodetic Systems Standards

transforms84.systems includes the WGS84 class, which is the WGS 84 version of the standard. Other standards can be created:

>> from transforms84.systems import WGS, WGS72
>> WGS72 == WGS(6378135.0, 6356750.520016094)
True

Helpful Resources

...in no particular order:

Contributing

PRs are always welcome and appreciated!

After forking the repo install the dev requirements: pip install -e .[dev].

Pre-commit hooks may be installed: pre-commit install --hook-type pre-commit --hook-type pre-push. This isn't required as pull requests are checked with tox and apply lint automatically.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

transforms84-0.3.4-cp313-cp313-win_amd64.whl (42.0 kB view hashes)

Uploaded CPython 3.13 Windows x86-64

transforms84-0.3.4-cp313-cp313-musllinux_1_2_x86_64.whl (265.8 kB view hashes)

Uploaded CPython 3.13 musllinux: musl 1.2+ x86-64

transforms84-0.3.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (189.9 kB view hashes)

Uploaded CPython 3.13 manylinux: glibc 2.17+ x86-64

transforms84-0.3.4-cp312-cp312-win_amd64.whl (42.0 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

transforms84-0.3.4-cp312-cp312-musllinux_1_2_x86_64.whl (265.8 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.2+ x86-64

transforms84-0.3.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (190.0 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

transforms84-0.3.4-cp311-cp311-win_amd64.whl (42.0 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

transforms84-0.3.4-cp311-cp311-musllinux_1_2_x86_64.whl (264.1 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.2+ x86-64

transforms84-0.3.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (188.4 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

transforms84-0.3.4-cp310-cp310-win_amd64.whl (42.0 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

transforms84-0.3.4-cp310-cp310-musllinux_1_2_x86_64.whl (263.4 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.2+ x86-64

transforms84-0.3.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (187.4 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

transforms84-0.3.4-cp39-cp39-win_amd64.whl (42.0 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

transforms84-0.3.4-cp39-cp39-musllinux_1_2_x86_64.whl (262.1 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.2+ x86-64

transforms84-0.3.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (186.1 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

transforms84-0.3.4-cp38-cp38-win_amd64.whl (41.6 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

transforms84-0.3.4-cp38-cp38-musllinux_1_2_x86_64.whl (247.7 kB view hashes)

Uploaded CPython 3.8 musllinux: musl 1.2+ x86-64

transforms84-0.3.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (172.6 kB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page