Skip to main content

Python geodetic coordinate conversions written in rust

Project description

rustmap3d

License Python PyPI crates.io Ruff

Simple, fast, and ergonomic geodetic coordinate conversions


Installation

# add to an existing project
uv add rustmap3d
# pip install it directly
uv pip install rustmap3d

# pip install without uv
pip install rustmap3d

Examples

Low-level transforms api similar to pymap3d and matlab

import rustmap3d


# wgs84 geodetic conversions
lla = rustmap3d.ecef2lla(x, y, z)
ecef = rustmap3d.lla2ecef(lat, lon, alt)
...

# local conversions
ecef_uvw = rustmap3d.enu2ecef_uvw(e, n, u, lat_ref, lon_ref)
ecef = rustmap3d.enu2ecef(e, n, u, lat_ref, lon_ref)
ecef_uvw = rustmap3d.ned2ecef_uvw(n, e, d, lat_ref, lon_ref)
ecef = rustmap3d.ned2ecef(n, e, d, lat_ref, lon_ref)
# enu, ned, aer
...  

# local rotations
enu_quat = rustmap3d.enu2ecef_quat(lat, lon)
enu_dcm = rustmap3d.enu2ecef_dcm(lat, lon) 
# enu, ned

# Conversions
dd = rustmap3d.dms2dd("25:22:44.738N")  #> 25.37909389
dms = rustmap3d.dd2dms(25.37909389, is_lat=true) #> "25:22:44.738N"
lat, lon = rustmap3d.ll2dms(25.37909389, -138.7895679)  #> "25:22:44.738N", "138:47:22.444W"
...  

# distance functions
lat, lon = rustmap3d.vincenty_direct(lat_deg, lon_deg, range_m, bearing_deg)
range_m, bearing_ab, bearing_ba = rustmap3d.vincenty_inverse(lat_a, lon_a, lat_b, lon_b)

High-level GeoObject API

import math
import pydantic
import rustmap3d

# Construct a GeoPosition from either global or local coordinates
reference = rustmap3d.GeoPosition.from_lla((0.0, 0.0, 0.0))
rustmap3d.GeoPosition.from_enu(rustmap3d.DVec3(100.0, 0.0, 0.0), reference)
rustmap3d.GeoPosition.from_ned(rustmap3d.DVec3(100.0, 0.0, 0.0), reference)
# all reference locations accept LLA tuples or GeoPositions for reference locations
pos = rustmap3d.GeoPosition.from_aer(rustmap3d.DVec3(90.0, 0.0, 100.0), (0.0, 0.0, 0.0))

# Conversions
reference.aer_to(pos)
reference.ned_to(pos)
reference.enu_to(pos)

# Operations
vec = pos - reference  # > GeoVector
new_pos = reference + vec  # > GeoPosition

vel = rustmap3d.GeoVelocity.from_dir_speed(rustmap3d.DVec3(1.0, 0.0, 0.0), 100.0)
dt = 1.0
pos = reference + vel * dt  # > GeoPosition

rotation = rustmap3d.GeoOrientation.from_ecef_euler(rustmap3d.DVec3(0.0, math.pi, 0.0))
vec = rustmap3d.GeoVector.from_ecef(rustmap3d.DVec3(100.0, 0, 0.0), reference)
vec = rotation * vec

# Orientations
rot = rustmap3d.GeoOrientation.from_axis_angle(rustmap3d.DVec3(0.0, 0.0, 1), math.pi)
rot.x_axis()
rot.y_axis()
rot.z_axis()


# There is also native pydantic integration for geo objects
class MyModel(pydantic.BaseModel):
    pos: rustmap3d.GeoPosition


model = MyModel(pos=rustmap3d.GeoPosition.from_lla((0.0, 0.0, 0.0)))
dumped = model.model_dump(mode="json")
print(dumped)  # > { "pos": { "ecef": [6378137.0, 0., 0.] } }

validated = MyModel.model_validate(dumped)

Comparison with similar packages

  • 🚀🚀 Blazingly fast - written in rust (see benchmarks)
  • Zero dependencies
  • Dead simple api modeled after pymap3d and matlab
  • Exposes rotations (both quaternions and 3x3 matrices)

Benchmarks

Compared to pymap3d

Note: This is comparing calls with python scalars. Vectorized batched conversions will be implemented in the future

  • ~50x faster for lla2ecef
  • ~400x faster for ecef2lla

# Run benchmarks
uv run pytest --benchmark-histogram="./docs/benchmarks" bench/

Build From Source

Uses standard maturin build process

uv run maturin build -r   # build a whl
uv run maturin dev -r     # build a dev package similar to -e

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

If you're not sure about the file name format, learn more about wheel file names.

rustmap3d-0.6.0-cp314-cp314t-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.14tWindows x86-64

rustmap3d-0.6.0-cp314-cp314t-manylinux_2_31_x86_64.whl (558.1 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ x86-64

rustmap3d-0.6.0-cp314-cp314t-manylinux_2_31_aarch64.whl (523.9 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ ARM64

rustmap3d-0.6.0-cp314-cp314t-macosx_11_0_arm64.whl (505.1 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

rustmap3d-0.6.0-cp314-cp314-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.14Windows x86-64

rustmap3d-0.6.0-cp314-cp314-manylinux_2_31_x86_64.whl (557.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

rustmap3d-0.6.0-cp314-cp314-manylinux_2_31_aarch64.whl (523.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ ARM64

rustmap3d-0.6.0-cp314-cp314-macosx_11_0_arm64.whl (503.8 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

rustmap3d-0.6.0-cp313-cp313-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.13Windows x86-64

rustmap3d-0.6.0-cp313-cp313-manylinux_2_31_x86_64.whl (557.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ x86-64

rustmap3d-0.6.0-cp313-cp313-manylinux_2_31_aarch64.whl (524.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ ARM64

rustmap3d-0.6.0-cp313-cp313-macosx_11_0_arm64.whl (504.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rustmap3d-0.6.0-cp312-cp312-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12Windows x86-64

rustmap3d-0.6.0-cp312-cp312-manylinux_2_31_x86_64.whl (558.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ x86-64

rustmap3d-0.6.0-cp312-cp312-manylinux_2_31_aarch64.whl (525.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ ARM64

rustmap3d-0.6.0-cp312-cp312-macosx_11_0_arm64.whl (505.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rustmap3d-0.6.0-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

rustmap3d-0.6.0-cp311-cp311-manylinux_2_31_x86_64.whl (560.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ x86-64

rustmap3d-0.6.0-cp311-cp311-manylinux_2_31_aarch64.whl (528.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ ARM64

rustmap3d-0.6.0-cp311-cp311-macosx_11_0_arm64.whl (507.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file rustmap3d-0.6.0-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 79f970722fce1e0da7ff7b84f45e78bc6a959e40ed9cfb9523032a44da6fd53e
MD5 f1efcbc572a29a89fc7ba541fc9cc740
BLAKE2b-256 0928edb12b9685ca88d586028c77d2fd12b31fea0fc9f7ca3ff8031e7713b468

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314t-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314t-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 75a08ab96f80ebdf1b534695a4d7796e905c85f2f5b834c236944947fc2153ac
MD5 f36ba6b99fae6a6b77eecabdff38e322
BLAKE2b-256 0cea98c82596de0c7f9cdca9dde76295a19a6082e031973deaced94116a71877

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314t-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314t-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 1f1aa68a77c11e9d6a8d332dbc42826f628c81a78d3d5979219e47b0124766d4
MD5 6466c9463dd2b7674a129b2bb83ad231
BLAKE2b-256 2e9da910318102cd3ed907d637560de2b9e6a9aab1c9b4430539c67f0ab3c80d

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 949c096b884d8b67073a17fd5e09404362eab53ad85e384519c99c9fb7a03f61
MD5 ea19e753dbcbe998eb261f81c4fed54b
BLAKE2b-256 79862cbb8a8b43dd4cfea5ac0c889bd069381b68c5d1f3f32a5bf9910fb6abd0

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ba175b384e7b458dc17d4d3a5372f57cb19b7376eb01841680362303c0a22261
MD5 7c6fbc9c3ba1d6884e9f19194233e668
BLAKE2b-256 f2ef5e205ed4f1ac6362eaf12a73f5347142aae7c8854beb62444d5f5769a00d

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 b3b898149cc2783d2167b1645e57a0ba8b19c338f02d140f20489177fcfa4aa9
MD5 db4ef61f89c80c9129a599e4c17e55da
BLAKE2b-256 20203b425a16113ae98fa49a4ba72c7097ed10415203d24eaa61d88bf3d2cf89

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 c98cd5f742db6c873a1a4954289e670177477f875a007a5e55cd8d0d645645c5
MD5 8366dcbd0b8a172bc842e435a09257fa
BLAKE2b-256 5a37d9c57cf91a94b8331d555e94a9d1da83e576f629e152d0526c09dff3e6de

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f7db797b06aeadf883131afbe8155754f18b0f2b577a3a3fb162260791ff0f8d
MD5 66cd18d1fb0e3c6b71b1f476b4fcc706
BLAKE2b-256 30c06b15e47dc969ea66cbe7307dbd31e1123050fb20ac4bf5b1d5821ebe0ae5

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 00859d760bd2d279a6d821c21a5e33af7b8f0324f1951fd21e5b086de35357c3
MD5 5e83cb574fcfe988769693259c0d1dae
BLAKE2b-256 1c5821f5058e4566ebbc64abbf16af20a12874ba817762f84f83d20bf6771a1a

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp313-cp313-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp313-cp313-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 eaa3d8d77ed0fc94c52ceafc5ece265d4ade09a2361d0e68ce028b44ff5c102f
MD5 f736cabd250930878aba4e23732b2a3a
BLAKE2b-256 d7081518cfb4135d82d2b5f6589f67f9805bd06f912a26fe84b8c0b0aa9629ac

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp313-cp313-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp313-cp313-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 6dfb1ed576b9006486fe262d514d4b6a220f98997f4ccddc2f5c694ede78b5f0
MD5 ddaf3a979ba3a434f62d9feea8039d3c
BLAKE2b-256 5e83c94a5395d270fce0959d9ca740ea5e80e6283bfd7118582bf16cdc94a687

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3045e7eded2cd5322d4a207ceb215bd5bf180911b0c52d2d02bb54ca9d24fcf2
MD5 e19f7aee5476f33b8ebd1169adc7a7a1
BLAKE2b-256 5b866f6a9f6de62ff54d916a0f2aab9f04edc928263690f7cf2e369495b345d5

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0cdb10058af7982598491a31e87f967e8eadafac244dd0bccef42fc7c974df60
MD5 6d0646fa993ad52c4029fe77cd7ee08a
BLAKE2b-256 82eb4754bec4135e01ebb69a5c5d41a6e56dcc86321c96d7ee2b52e24cf5c258

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp312-cp312-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 0c445f0791345fc756cba6e99a46d9d850ebd72fee7a58f424ba11e06016fef7
MD5 20df04db00db10adb7cae5ebb60e7d47
BLAKE2b-256 9995bbb62c771e918bc9db611183522d3cc8c53ed51d1321dd6a07dd9d9d287a

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp312-cp312-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 a04973474f44f4cc06a22514780edeea77c1af22e654e95c797c989569550833
MD5 db274074631eb6f8fbf50f9a86aa7bef
BLAKE2b-256 8f5fd46fa239b664d923173fcb73b96b1dacff078afbf31b1c16ef0d941a29ce

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b20ba9018b2fb90abbf7527ec424bc1ef096f3083cf99512326c1e2523588775
MD5 1f8a27caf1608fb24db04869d3b3c265
BLAKE2b-256 d2897823893fa7319f4764e1a3d14c3f321c504d2776ee15e19b380c9734b212

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 a72e9c555eed03de1643e7bfa435f9781c4abe9631843e744b10aedc6e758da8
MD5 0e97a49ed5ae2710af574f5ac5384161
BLAKE2b-256 3e11fce526d778315325bb3eed125a66f18518a8b5dec35d303a48053ba74a05

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 dcb8f200975c876e4ed92745a446da3a6ade819f5dc11a9585dd881164bad623
MD5 81c6188de1101455a9ae6c89bc663c76
BLAKE2b-256 0a75b6ea45e74278cebad65a2db2eeac57c47be9d39c26cdd74e9e69933bbcfb

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp311-cp311-manylinux_2_31_aarch64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 1cea910fcb1d45650b0e90392e2c66ca9499565b55806576b0c0aa7f079e6a23
MD5 50be2777eea8d511fcaa41d63b91f6b8
BLAKE2b-256 7d91436ed85680985fc5bcffd5a778e277df1c4ebb8c871d6e0dc62c07a96d4b

See more details on using hashes here.

File details

Details for the file rustmap3d-0.6.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rustmap3d-0.6.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bbcad47b66329ed012c464efe350395c197263634a9f352204d8c8376e08f386
MD5 a8ee9879db6c8206ca6ad6057f7d4755
BLAKE2b-256 27161600143632fa911d7544869b675f2e571596799f536847639c497c15e1c1

See more details on using hashes here.

Supported by

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