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.4.1-cp314-cp314t-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.14tWindows x86-64

rustmap3d-0.4.1-cp314-cp314t-manylinux_2_31_x86_64.whl (547.0 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ x86-64

rustmap3d-0.4.1-cp314-cp314t-manylinux_2_31_aarch64.whl (510.3 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ ARM64

rustmap3d-0.4.1-cp314-cp314t-macosx_11_0_arm64.whl (491.8 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

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

Uploaded CPython 3.14Windows x86-64

rustmap3d-0.4.1-cp314-cp314-manylinux_2_31_x86_64.whl (546.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.1-cp314-cp314-manylinux_2_31_aarch64.whl (511.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.1-cp314-cp314-macosx_11_0_arm64.whl (489.4 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

rustmap3d-0.4.1-cp313-cp313-manylinux_2_31_x86_64.whl (548.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.1-cp313-cp313-manylinux_2_31_aarch64.whl (512.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.1-cp313-cp313-macosx_11_0_arm64.whl (492.1 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

rustmap3d-0.4.1-cp312-cp312-manylinux_2_31_x86_64.whl (548.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.1-cp312-cp312-manylinux_2_31_aarch64.whl (512.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.1-cp312-cp312-macosx_11_0_arm64.whl (492.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

rustmap3d-0.4.1-cp311-cp311-manylinux_2_31_x86_64.whl (549.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.1-cp311-cp311-manylinux_2_31_aarch64.whl (515.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.1-cp311-cp311-macosx_11_0_arm64.whl (494.1 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 1f523c4dcb2fad4eeff62bfa4160611b09e489aabf151ddc8708d16ec3714089
MD5 91098544356f679a66b013116f08a922
BLAKE2b-256 add39ed32a499168d016e30c78ab9c77f19229d60f9e690578325a80fdaec629

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314t-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 4e0988c0329dfdb19e0b76a97560640edbd53fd9d7ac83862b0281aca2b521c8
MD5 16408bdfb36e60c530329e1a95d7cc25
BLAKE2b-256 090c3df7ea05fbcfaca2cfc35cc09b393ce4aa7854790c21e73e3c23e5a4c18a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314t-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 ac91d21d46a334c5a1714e15b91e0146c6407d2d68d93de031ed7340680ca139
MD5 d2f094740a0732e56740695ad51e96f4
BLAKE2b-256 3d06c2a966a39c9a21553321f80354fc84683b02eb7d707929686605952b0a5f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 47a50ef582dab949577d3dee2236ee43dac2d7282d154f2e84342b5501fe8392
MD5 91bb1bb60a910525c3d9d4156eb5b14a
BLAKE2b-256 18096263d19be2bb12acbc9630fb0c6e81e155bda3f4ff7a79581d8eaf223d2a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 25adeb9ee9532040a7d4d193d5bdfd85eae0473354e69cbf1fb9a1b248ec28ed
MD5 4813cda91a01419e85f2ba74017f55c6
BLAKE2b-256 d6a1bc691382d93492c52288bfff55b21c26665fa1e4de4d967ad61464fafef9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 9b586881c444a47280e7f800eefa41f7ce4f96802654f2347d5f5d7d06ee8cfc
MD5 d9cbcc9d1043740d4bf7baa0dcdefb1c
BLAKE2b-256 c842caf7e6943278b4ef254a77999ead2c5993339d842ce233a529a54fa49023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 5701b8851724c4b30a5d2d56b32efde39d876a95fa7fe7a4d835063740229e46
MD5 b18aaa27829aea453408f6ffcc689e52
BLAKE2b-256 62b226cbab4d9d73dc8f72bedf445a73b650e91952eb8798c30260662cbe6bf9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62b3328c6a808d13673fa1ea4eb6157e06c034bb2202cc4f76e93735753f89e2
MD5 30011410a35ebc7b7103e2824409747c
BLAKE2b-256 8e0099dc747286af6ee211f169da0187b5342459903f530ec348def8d3401337

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d0361be8a6465fbcfc89ef03f77b532fbcb574d64b0fd0f206cd103c8527b634
MD5 725ef4ba87722a6aaab6a95cc3e30276
BLAKE2b-256 0410d89e41941d3d3cc2bfb9cebe46a9f19e4b839b85fceb06e13b1c2ea8716e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp313-cp313-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 26842ff3d17cfc280425fcafa60212a8c8405b20d8324e6fd2e8f4bfd8208377
MD5 e91c00df47ee916bd15ac27acc9d36a9
BLAKE2b-256 dcc65651ccd59ad7bc78767680255ffe16a013ac19012a017d5e9a9625541f17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp313-cp313-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 dd60e5fc6ab847b642a261e6237ffb7d9ecdd1b77c09e20c3b5282dc6c3d3a8a
MD5 ef6d36d7f7e2708adff9f0684b249f43
BLAKE2b-256 e55965f9a2da2f2e2689422f3d9a983a70082279b7e61c1c812bd72878d400d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 81d7ff82dd8decbf625b6c9058feedf57704382547fb9e15120c2da42f8cef1b
MD5 630f9a03bdda422c05e4e3ffbccfa2a9
BLAKE2b-256 952ba7b8ac614a55ec18b10e3a76b31e0ba2c255a060523a7313c52b006e7838

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 0f78b15933b5061d0110464853d01f6d42b130d15c0984ff892481c52dfd15d8
MD5 70eb0083242c0ced530f2d593a18b6dc
BLAKE2b-256 59f081630b9921aa2d349d840805003fd685ae9deb124b3f4b26d3405e7c458e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 0379ee91f06339028de4487e80f3e2b8355d7d6c4bc06f0383e7c3f2cd8b2ef0
MD5 1b904c72d39ed437c7ed51a2499852f5
BLAKE2b-256 4ffd895193075d04d5609b9e10ee9697b1fabbd0ce7b4f2a54b9f522199ab6b7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 ed3fd9220993e28d3ece32f6fd244c9e0178fcae4da2f9d78794aa9bf59b73bf
MD5 f160f693c7528b0028df2e395240a1de
BLAKE2b-256 ce4fa6731db99e435e114dec0bf79e9b50666a29a6ef1ce1be50e5278d685ba8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6c01e8ff1b1a19fe0bd175df686f2f505cbe2eede9967737a8db45507ad35316
MD5 f849a9703edf6f9c0db9b8fa9ddef445
BLAKE2b-256 584e4537226b8e6f0512ef27718f9d9591bac03bc04338a9a8d817451cf5b952

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 29bb4b85dd4626ba1ca8dfa8322a02e8bfbdf70a3277250ec8db00a9175f4361
MD5 89fb7a02078810a933c8bd71e577b9f4
BLAKE2b-256 86852e33b2cb8f7986cdf65f7d4d2005bfcd4634ee4381f21cb656fbe0ec5946

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 13876c3168e3d23c1658f92f0365fe7213f524cbeec9ff55da30e527d459c9f2
MD5 c1258518f70b3aaeac1bf5adb53f8a80
BLAKE2b-256 71bd936e60fa0e05b34956c2cb42fc227d5cb736adcdfcc31bbf4c777fa1af6b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 61ba87d4bfb95ce8f16761b1942861b32e8ece159c49ec51fd45cbd4e4823d65
MD5 ec6c457182adbfdd71d27a1bf33a8c46
BLAKE2b-256 d6a630ab76b84c641a4a9a33682b86ffcf62a2b92cfdc0c748e790de0fcbba44

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ac4021fea0b6e6cddcdce4e35c50a08c0084e56d9ab4c4b4fc09b26d70dbca1
MD5 a3f404343001b836a49e48f134c7fe21
BLAKE2b-256 5a6345a006a467cf90164537c82aa6390b93d6f59a6481c452a3f587240959a7

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