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

Uploaded CPython 3.14tWindows x86-64

rustmap3d-0.4.0-cp314-cp314t-manylinux_2_31_x86_64.whl (529.0 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ x86-64

rustmap3d-0.4.0-cp314-cp314t-manylinux_2_31_aarch64.whl (493.7 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ ARM64

rustmap3d-0.4.0-cp314-cp314t-macosx_11_0_arm64.whl (475.3 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

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

Uploaded CPython 3.14Windows x86-64

rustmap3d-0.4.0-cp314-cp314-manylinux_2_31_x86_64.whl (528.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.0-cp314-cp314-manylinux_2_31_aarch64.whl (494.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.0-cp314-cp314-macosx_11_0_arm64.whl (472.5 kB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

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

Uploaded CPython 3.13Windows x86-64

rustmap3d-0.4.0-cp313-cp313-manylinux_2_31_x86_64.whl (529.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.0-cp313-cp313-manylinux_2_31_aarch64.whl (495.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.0-cp313-cp313-macosx_11_0_arm64.whl (473.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

rustmap3d-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl (530.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.0-cp312-cp312-manylinux_2_31_aarch64.whl (495.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.0-cp312-cp312-macosx_11_0_arm64.whl (473.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

rustmap3d-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl (531.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ x86-64

rustmap3d-0.4.0-cp311-cp311-manylinux_2_31_aarch64.whl (499.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ ARM64

rustmap3d-0.4.0-cp311-cp311-macosx_11_0_arm64.whl (477.5 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 02e72f43e67ba6ef4f7086733d9f3d8442ef6e97afa10e5be8e559074bb8785a
MD5 a6dc93e0dd546b75f730056998bfb5ab
BLAKE2b-256 fbddfbb56de9546965aa14480c8f52c3281c505b813a0e7c79c89bd123d62616

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314t-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 d5a09219901e165981f95716e34f8780c1115ab68582f77639664963414c2c7e
MD5 caf11c182040058559c1895300a5cdb2
BLAKE2b-256 d12d23a0307216e3a7db2d1b6359a1f47f36f9face274ccb784904e995191323

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314t-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 e3217aa1e218a94d8ea3476763b380a9226b2412eb9097c77f17836b94a3a803
MD5 12a4d2de3b84355363fb543fae1dba70
BLAKE2b-256 b10da5f643ed6b0b5347ec25eca190cb3e81a73a3e602c8c95e5ded1b81722e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fccd90ae2fba5ce8feddf181234048fa21e219f0c0d0fc4a4a8a3b08842e3fc5
MD5 9bb1de6654960d34c747ce25b628206a
BLAKE2b-256 34f9dd7f88d1bbfa56e50f221dc26955adac896546f5e30fdac095eaa1c01a7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 ea4f72bc593c26c222ce1d210283f799dd521e7ba5805130f65c1bdc94c25b9a
MD5 68f670f8a51144cb9fedda7969c220b8
BLAKE2b-256 d7f89565e98a05250a37b1e9a8cbd258df6b40f363d384e99f4007033b0aafe8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 dc6a12e46178a9e445aeb768d1dbefdcd8c32d2f59f2d7bc31ec0432b4592f6e
MD5 999c62e5d4cd8bcc8af105256446ec4c
BLAKE2b-256 dd4e170334b346081d1802d3d10b06b5fbc6fbb2b0330b764434a8eee2062275

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 217630e1e06d96216dfa657bd7499d3ca5c134b55aac624d3e28c03102e1cacc
MD5 63796b93875f8b0dd4b6b8b173a7fdd8
BLAKE2b-256 063285e0253fb22b7ea40d23d128f8d17caa46243b6c303f8e30f93d232b0152

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa8c91c9edfb828ac9aa1a744f9c1cb15a5c156c9570c83776cc2cdb920044a8
MD5 16243a351a4d03172697440972c957f7
BLAKE2b-256 33c9f5f97bd84e3ed79dcfe6f43f86d6e0008709500829edf7fec3ee79d8d5c6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5ed136a18a1604dc1c2034b316fd4131e391db635fc883f973fb99f0788e931c
MD5 dc95a8617d61c54cf082c92b0db1d0cd
BLAKE2b-256 7115d14a1808e6c301ddff34512dd355d3541bbc12a5d073d86ed35ccc8dfd27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp313-cp313-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 50dd3752ccdba61e3ef363c305bf17170041d956e2da84bf51a9b956d633c234
MD5 51b9157f3262bf7d197494e3aee55fb0
BLAKE2b-256 7e54570532f722aa8d11927e56dc7f34505d5d66c6d524ad7aa2eb46be470986

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp313-cp313-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 48d485ee51cd545aadc8280a5c3edede7cd6f49ce327b79dff75e1d5bb5b70a2
MD5 d19012c1143faaf467428d0cf73e517e
BLAKE2b-256 83e363775e67f9a6a498ed9b3d16a3624265c52096f4c60d313fdd521240de58

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 401cb1ba982a5b2a31aafb8400e46888484bf9c84dc0270fb5c6754cd6d0f8a5
MD5 002dd46435160730cf96ed26fddf30c5
BLAKE2b-256 49e50443bcb232b5c32347b043e1cacb7c9cf79fd50fd4b6d274e492f8a594c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 e78c0d5a78b73c4d61b38a9343bd8837bf0638d122b11e2f4457527ea0211a4f
MD5 7e520b56507a481692ddf25a2de84078
BLAKE2b-256 71f5131cdcb63f7b9aea6ff3fea0dd86758672a857b22f61fb2ecc09ff168029

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 bfc537e3704e6c8a6ea515f8848960f44d7ea6cdd822b621dba8ee47ea3f137a
MD5 9e2edab4bbeb707ed0ec78666d9ea4ae
BLAKE2b-256 8d9c67f5d7d9fcd8f30cd814f2ff83d610698421062489484a82cf27934f8be6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 1e5d23939588545aca977ad0630dba7c84c8dd334a8378535d80c83d11aacdd1
MD5 f765400bb9a1cd7c44d2e3176c59cfe0
BLAKE2b-256 697754078d5e5f49a07f8f95eb21c0940cc7d2d518f771b1899e292efe431f3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27db8b00f03227a392b39bd5e00e11735857e711464683dfa1d35fcd03d2f303
MD5 82dfabf1bb427d36a19db455e8df10e2
BLAKE2b-256 b2ec64de65def9d6a46a702d962adb790d4a8219af25a9cd78587ac9c89d0a71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 29c0a27bd2df45913d24cebff4995b2a152e67b71e9a745448ed09f4cf80ec4a
MD5 656f8dcde1d6b69d906881803e58f1a8
BLAKE2b-256 5414a5bb8f44d7e52da18cb0117ad6e158a405231bb8f3805cef7a99fa7b2fb3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 e5f219077549a8d46a797cba4f6ad36aa62e98a99c909c64122a8c7a4734328f
MD5 65949ca8552d64a6bf3a1480f3f53155
BLAKE2b-256 8ef9156387ad2891186ab788f9bdb7759defb2770f3dc29d2b4c519ccb51080d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 efc3baa16b43bd718210c33ec74c908c038f3b01c273ddcaa0961689eb99e3d3
MD5 bf9c26732d0550f389224f7392ec22bc
BLAKE2b-256 39a8dc41ea79912626aad6b2e94ed1d40aee70f5bec5967c89371e31711b30af

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for rustmap3d-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4782539079064ba2a8c091ee1505a8f5957d8e34f19f5102f603fd854b53b3af
MD5 d9f76088b3d55a0e4cfdfb709754abad
BLAKE2b-256 dad889c2e7a801f6967e379d951c5cafb53ea897e416760ab78fb6040af9ed04

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