Skip to main content

Fast GPS to local Cartesian coordinate conversion using GeographicLib

Project description

LocalCartesian

Fast GPS to local Cartesian coordinate conversion using GeographicLib.

Description

This package provides efficient conversion between GPS coordinates (latitude, longitude) and local Cartesian coordinates (x, y). It uses the GeographicLib C++ library through Python bindings created with pybind11.

The package exists because GeographicLib's Python bindings don't include the equivalent of the C++ LocalCartesian class, which is essential for many geospatial applications.

Installation

Install from PyPI using uv:

uv add localcartesian

or via pip globally, or inside any Python environment like virtualenv or conda:

pip install localcartesian

Usage

from localcartesian import gps2xy, xy2gps

# Define some GPS coordinates (lat, lon pairs)
gps_coords = [
    [40.7128, -74.0060],  # New York City
    [40.7589, -73.9851],  # Times Square
    [40.6892, -74.0445],  # Statue of Liberty
]

# Define origin point (lat, lon, altitude)
origin = [40.7128, -74.0060, 0.0]  # NYC as origin

# Convert GPS to local Cartesian coordinates
local_coords = gps2xy(gps_coords, origin)
print("Local coordinates:", local_coords)

# Convert back to GPS coordinates
gps_back = xy2gps(local_coords, origin)
print("GPS coordinates:", gps_back)

API Reference

gps2xy(latlon, origin_latlonalt)

Convert GPS coordinates to local Cartesian coordinates.

Parameters:

  • latlon: List of [latitude, longitude] pairs
  • origin_latlonalt: Origin point as [latitude, longitude, altitude]

Returns:

  • List of [x, y] coordinate pairs in meters

xy2gps(xy, origin_latlonalt)

Convert local Cartesian coordinates to GPS coordinates.

Parameters:

  • xy: List of [x, y] coordinate pairs in meters
  • origin_latlonalt: Origin point as [latitude, longitude, altitude]

Returns:

  • List of [latitude, longitude] pairs

Development

Building from Source Locally

Clone the repository and navigate to the project directory:

git clone https://github.com/PastorD/localcartesian.git
cd localcartesian
uv sync --dev

It will fetch the GeographicLib binaries, build the C++ extension, and install the package in editable mode. You can now import and use localcartesian in your Python environment. See examples/basic_usage.py for example usage.

Generate multiple wheels locally

For Linux

uvx cibuildwheel --platform linux \
    --only "cp39-manylinux_x86_64 cp310-manylinux_x86_64 \
            cp311-manylinux_x86_64 cp312-manylinux_x86_64 cp313-manylinux_x86_64"

For MacOS

uvx cibuildwheel --platform macos \
  --only "cp39-macosx_x86_64 cp310-macosx_x86_64 cp311-macosx_x86_64 cp312-macosx_x86_64 \
          cp39-macosx_arm64  cp310-macosx_arm64  cp311-macosx_arm64  cp312-macosx_arm64"

Running Tests

uv sync --extra test
uv run pytest

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

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

Source Distribution

localcartesian-0.1.4.tar.gz (44.1 kB view details)

Uploaded Source

Built Distributions

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

localcartesian-0.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

localcartesian-0.1.4-cp314-cp314-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ x86-64

localcartesian-0.1.4-cp314-cp314-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

localcartesian-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

localcartesian-0.1.4-cp313-cp313-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

localcartesian-0.1.4-cp313-cp313-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

localcartesian-0.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

localcartesian-0.1.4-cp312-cp312-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

localcartesian-0.1.4-cp312-cp312-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

localcartesian-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

localcartesian-0.1.4-cp311-cp311-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

localcartesian-0.1.4-cp311-cp311-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

localcartesian-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

localcartesian-0.1.4-cp310-cp310-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

localcartesian-0.1.4-cp310-cp310-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

localcartesian-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

localcartesian-0.1.4-cp39-cp39-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

localcartesian-0.1.4-cp39-cp39-macosx_11_0_arm64.whl (2.0 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file localcartesian-0.1.4.tar.gz.

File metadata

  • Download URL: localcartesian-0.1.4.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for localcartesian-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b4f76afe23d3e16acb09c7be6a202066f3c0b4a7672bc3b9b2f11589aa0158cf
MD5 1883679153aac7b5f48b20b7845e77cb
BLAKE2b-256 b780915beb4ffa2cc2584785160601913c2747ba4d6dc40a945b3cd8ff5fe5b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4.tar.gz:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ac67afc82d68343077c7eae389792ae7a8515c65794e1112d1ed3bdf28a29e7d
MD5 db9d436ade09b59a047f41189baee3ed
BLAKE2b-256 bc9d0ba8a6e3f9588c6512e126c07978c830344324d15c4d3526f5079f6e2a97

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp314-cp314-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b712bc402a200fc9c7c6baa176634389f551beb80ceec6016c9ad92ecdc0fa4e
MD5 2c536f4f16513ab89ba8052bf0794b93
BLAKE2b-256 010dce62992541c80865384969bb5b1a7df5c1382190e5c4cb61f439ecacf9ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp314-cp314-macosx_11_0_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49907dca1c6ff505a60934dc289fd333758d8653ca91a3a734959b1a344e1147
MD5 268f62ad0ab875f00c9125d5f298120e
BLAKE2b-256 83b479d628038ee8c37b0f8692850c30988a9b6e0d0c2799075d207dffb0d2b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp314-cp314-macosx_11_0_arm64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0722324aed2e5c3c3f4c108ec74526f5b2f962d809573f7b19b51795a322742c
MD5 4df7ed36e22f1e99121ebe4f121b1b0b
BLAKE2b-256 784fbc131d6b3c9a18e54d085ec857de8f1418110d69c3ffda35822955f180a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1842fc7382b01d5d8399caa9caa8a1622b2fc649bddc85fde66bba97f9fa66d3
MD5 01c0113587c7929419756ddf42ae9fed
BLAKE2b-256 f917d5aed5ffabcf18c1d86454f861318f9125f8789b368af398f711fe19f7dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp313-cp313-macosx_11_0_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 377fd0620a0dc4c666403f7c790d0a5751fec62d86996b632e8a869024b75fb9
MD5 598cc97237e40c8ca19dda12b2d7320b
BLAKE2b-256 91846d7e9cef167bafd3b3e5edf423a58e32ea67323c6e532597ce1be22c5115

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 47863d82d29597c28b1d7024c21505f8a708617a96e0be3be47ee0a29c7456e6
MD5 5a624bd1f3b19d2192a95219c8f56b69
BLAKE2b-256 ba743ab1aac0e0cde530d3263d2e0c18a2a86287f11c351f61fd07fb9ab0c876

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 bc75f8ea4a32aa7df9203bb7724c9ec9d864ec41a8cb93a299f070e29788e596
MD5 b22529c63746923b2c276c8723f6c206
BLAKE2b-256 fd1aee204c33e07ef6997efce5b7d66fbfa622f92206466c1fe9bbe516eba54d

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp312-cp312-macosx_11_0_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8e0a106cdca146f75691a318d3849c8942d06a8877ada847b41d25fc6156a0b7
MD5 431b0eaf2f0bfe46cd6ab656f6f1164f
BLAKE2b-256 536200a87c6ca3aa37324efa6c872a1eb1434f75172654bfe5ff515bb35e93e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 10aa5b3fe9fbffde221cfbbda1f0a0206f0dbcc9df4e6588e27494f703e05664
MD5 8b2c6b63927d6da702860edc423d403f
BLAKE2b-256 f46f05e2ec1579f4c9c16f6c441d09cfe22079b869777a6d81bd1c4a107a5600

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b934e124fbe43e93366f276f993e4d05ff5397eee5ce9a3fa0388b83791e5480
MD5 9b0ad583e385047a89782c8a98e7b5dc
BLAKE2b-256 b84a30c7e1e78be14682446ad11e664c1c9dbfd41e67de887ced30ed3a9cf703

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp311-cp311-macosx_11_0_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 68a018fb5da11828ca580a915427ad30afe855bbf115c507f73acd40e460d929
MD5 e17fa944d1210e743b60d9bdbc17adb5
BLAKE2b-256 08e9dd58ff9da1d99323f004b87e50d1c9c70f7479dca7de88ea6b5baf680eae

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 38d28316b875f3bf0f2f213f3f085c420c705923671f710a1f8971cb21059a3b
MD5 56e9eb7bbb4941617237f0853d0c94f6
BLAKE2b-256 92318d6cc6352e6d23a82a9297747b0c574ff68c9980dee830c5ee046b6ec7e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9ec5d39d5f83a2f9425b7991a450ccb625a98e68d9af096ee4919cffc16b9926
MD5 fae0960da5d9815a07065799c0d9d6cf
BLAKE2b-256 31e8cbfb65d12332c97d7f2644536b93fd3672a2e585ae2e861c6ac19c0642cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp310-cp310-macosx_11_0_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 eae74d84fec7c7b05a04b384888a7207e6a9cf93514230a3c1703115e8a0c52e
MD5 be3af0d1fd1746e1e16944830484523f
BLAKE2b-256 2cb60a95ca838a765dc74f45775be989f4d81b8d7d554d900b2252be269617fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0e26ddcfdae8ed4a7f68d4d30686b5d8da32c4053ffe03e6644bfa9d87246364
MD5 71d77e6078b82232001ccbbe1b74ae2f
BLAKE2b-256 4c066025c4c946df27e92c5619be545c6ea00c82151377e32bbe393ddf75195d

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 338f7c4ffd04352e3312d5b17e79954e0256f62b8296822e1320da9b95228f45
MD5 20df20ef63bc9523addca256d09d10cc
BLAKE2b-256 06d32e2d2e06b37a9f0d247c6d7b58a7c1bdfffbc136797db8e93a94dd00d8b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp39-cp39-macosx_11_0_x86_64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file localcartesian-0.1.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for localcartesian-0.1.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5d99854beb52d091368428e73bcfba9327e44fb420f33ebda009d74017d066ce
MD5 c1dc81947aaebccce3d540e4e9b3b119
BLAKE2b-256 97b215b57acd7ecfd524eaeeaf15f33ecf73d02aec8d39598ac5d0a7bb48ad68

See more details on using hashes here.

Provenance

The following attestation bundles were made for localcartesian-0.1.4-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on PastorD/localcartesian

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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