Skip to main content

pygeodesic

Python library to compute geodesic distance over a triangular based surface mesh.

A Cython wrapper of the C++ code by Kirsanov, which is an implementation of the exact geodesic algorithm for triangular mesh first described by Mitchell, Mount and Papadimitriou in 1987.

pygeodesic is similar to other libraries on PyPi (such as gdist and tvb-gdist), but:

  • provides a wrapper of the GeodesicAlgorithmExact class
  • exposes geodesic path (not just geodesic distance)
  • licensed under MIT license similar to the orginal Kirsanov C++ code, rather than GPL

A good alternative to pygeodesic is potpourri3d, which uses the heat method and vector heat method to compute geodesic distance over surfaces and point clouds. However, this library does not currently output the geodesic path on the surface.

Requirements

A C++ compiler is required if you are not installing one of the precompiled wheels. Although pygeodesic is a Cython wrapper, Cython is not required as the cythonized C++ file is also provided.

VTK is used for visualisation in the example notebooks.

Installation

Install from PyPi:

pip install pygeodesic

Installation from source (from within folder containing setup.py):

python setup.py install

Usage

Loading pygeodesic:

import pygeodesic.geodesic as geodesic

To read the mesh files provided with the original C++ code:

filename = r'data/flat_triangular_mesh.txt'
result = geodesic.read_mesh_from_file(filename)
if result:
    points, faces = result

To calculate the geodesic distance and path between two points (the source and the target) on the mesh:

# Initialise the PyGeodesicAlgorithmExact class instance
geoalg = geodesic.PyGeodesicAlgorithmExact(points, faces)

# Define the source and target point ids with respect to the points array
sourceIndex = 25
targetIndex = 97

# Compute the geodesic distance and the path
distance, path = geoalg.geodesicDistance(sourceIndex, targetIndex)

To calculate the geodesic distances from a single point (the source point) to all other points on the mesh:

source_indices = np.array([25])
target_indices = None
distances, best_source = geoalg.geodesicDistances(source_indices, target_indices)

To calculate the geodesic distances from two source points to 3 target points:

source_indices = np.array([25,100]) 
target_indices = np.array([0,10,50])
distances, best_source = geoalg.geodesicDistances(source_indices, target_indices)

For more detail, a Jupyter notebook is provided in the examples folder to show how to use pygeodesic to compute geodesic distances and paths.

Example using the Stanford Bunny

A Jupyter notebook is provided showing how to use pygeodesic to calculate the geodesic distance and path using the Stanford Bunny as an example.

Release files for pygeodesic 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pygeodesic 0.1.11
File Size Uploaded
pygeodesic-0.1.11.tar.gz 36.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for pygeodesic 0.1.11
File
pygeodesic-0.1.11-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
pygeodesic-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
pygeodesic-0.1.11-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
pygeodesic-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.13+ x86-64 Details
pygeodesic-0.1.11-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
pygeodesic-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
pygeodesic-0.1.11-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
pygeodesic-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details
pygeodesic-0.1.11-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
pygeodesic-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
pygeodesic-0.1.11-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
pygeodesic-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
pygeodesic-0.1.11-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
pygeodesic-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
pygeodesic-0.1.11-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
pygeodesic-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
pygeodesic-0.1.11-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
pygeodesic-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
pygeodesic-0.1.11-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details
pygeodesic-0.1.11-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details

Total release size: 13.9 MB

Release files / pygeodesic-0.1.11.tar.gz

Download URL pygeodesic-0.1.11.tar.gz
Size 36.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a9b54eb20d57f5499d8b2a4a67ece675a44c6fc8d00b11e8c14c8c99edeee5ed
BLAKE2b-256 checksum
How to use checksums
6633174106049bdea633e537f14fc39ebc68f2f97994591911b4e64e4870803c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp313-cp313-win_amd64.whl

Download URL pygeodesic-0.1.11-cp313-cp313-win_amd64.whl
Size 1.3 MB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
a76e838faf172001a12ca4cab6f6df17fc5e8cba13dd2317675df83e8a14c9ae
BLAKE2b-256 checksum
How to use checksums
9829967ad2b817a530a866ee9531452439bd1f1bf61c564b2fb85f37741795a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pygeodesic-0.1.11-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.0 MB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
667dbfc3692b0d205140275157e6275d05910de9b3cecadff2d439ebb5386e8d
BLAKE2b-256 checksum
How to use checksums
7dd4c0e2fa21ca048e0199a3bee1438d5fef6591b65d2c856d8b7934c9bb5af7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp313-cp313-macosx_11_0_arm64.whl

Download URL pygeodesic-0.1.11-cp313-cp313-macosx_11_0_arm64.whl
Size 251.5 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
4ebb75522b7e668a056ae33958d912dfbf5f6926048eb581cd1411c109a60475
BLAKE2b-256 checksum
How to use checksums
28ea37deeb6c02599048ee1a05750a119744e394d2f746f2f51cf5e02f030ed2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl

Download URL pygeodesic-0.1.11-cp313-cp313-macosx_10_13_x86_64.whl
Size 257.3 kB
Tags CPython 3.13 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
223e77235d0cefafb9b37ab2bcd8b99f94d4f819dfcf18c32e6f83d270eaf614
BLAKE2b-256 checksum
How to use checksums
1f03b7e5e98cc2a1a738d07daf6a2736b6c83c394e997ddca41a675eed11ae1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp312-cp312-win_amd64.whl

Download URL pygeodesic-0.1.11-cp312-cp312-win_amd64.whl
Size 1.3 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
585e6fd35babbda2fa9b87f23d05e0ec26e1e416e069997ed137ac04b94f05b9
BLAKE2b-256 checksum
How to use checksums
e60b03af381ad00eaf56dde8156d48c0c4b7c5b928dd128221619d8b3cfea901
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pygeodesic-0.1.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.0 MB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
495101cd634df7afe108a63419a864c77098c490608934c642b9d6eabc946ec1
BLAKE2b-256 checksum
How to use checksums
6b3d972e2207d5845b6129f553376010b0bddecc2b1b74799e186d97e0f326d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp312-cp312-macosx_11_0_arm64.whl

Download URL pygeodesic-0.1.11-cp312-cp312-macosx_11_0_arm64.whl
Size 252.3 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
fc730367f4b2f7067c6f79269097d00eda969ea044c6d123db0769abca306638
BLAKE2b-256 checksum
How to use checksums
505a61e8e9f8616427cf29310da628d5e5a836892c6a0503a08fee3439140285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl

Download URL pygeodesic-0.1.11-cp312-cp312-macosx_10_13_x86_64.whl
Size 258.1 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
4bb9675435dbe1291989f8d3b33b80421e6ac7da819fe362fa82eab5519a16e2
BLAKE2b-256 checksum
How to use checksums
d44bfa724ded65584cff1b024016783614393c770a3b8ff9e0b2b2352153f955
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp311-cp311-win_amd64.whl

Download URL pygeodesic-0.1.11-cp311-cp311-win_amd64.whl
Size 1.3 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
e8aad25facf737ce70669e6bf16056426ae0f786721f272077ee6fbc2dfdff1c
BLAKE2b-256 checksum
How to use checksums
6889bcd63cb7bee31fffe526bdd31f4a65abe40beacba894a7f208ed10ee9576
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pygeodesic-0.1.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.0 MB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
054242d85e7c7ed0c65d8de94aebb869c0a29b0b1719bfbc4f321088159e5255
BLAKE2b-256 checksum
How to use checksums
2b9ecd246386d325c37e78508cd92d7766b379ed34591189c578864e623d3839
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp311-cp311-macosx_11_0_arm64.whl

Download URL pygeodesic-0.1.11-cp311-cp311-macosx_11_0_arm64.whl
Size 252.8 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
a6bde2fef5e06e6d3579bae9273dde166e068abd67616c76b96be10cd70ef9e9
BLAKE2b-256 checksum
How to use checksums
42e14404622c488a86fa255578ffa6366db26b008e127c917003fb5cc1c0ba5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl

Download URL pygeodesic-0.1.11-cp311-cp311-macosx_10_9_x86_64.whl
Size 259.0 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
02228e385e8ae35d520f9de8872063f88a1faf475e396a3363617b83a2fb51d3
BLAKE2b-256 checksum
How to use checksums
85a6300133dfa4f0b33276763fbdd94550829e33401ecc2893cb3b3aca5cf7e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp310-cp310-win_amd64.whl

Download URL pygeodesic-0.1.11-cp310-cp310-win_amd64.whl
Size 1.3 MB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
bcb310b9fa23e869f0662d0ceaeed3497eaccaa8165b2d60a37d1484069c2e7e
BLAKE2b-256 checksum
How to use checksums
67b41a869fe63d296073c6d71f825cc4a84584348fe93a2bb1afb405139ce531
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pygeodesic-0.1.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 986.3 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
32a318f41f0910579a85aeadf2810c815f41e33d06d5abba3d9c3b475838b5cc
BLAKE2b-256 checksum
How to use checksums
1a66c134db3ed52a1c968d755620145381379478c7a4c451f0d3e58e898454a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp310-cp310-macosx_11_0_arm64.whl

Download URL pygeodesic-0.1.11-cp310-cp310-macosx_11_0_arm64.whl
Size 253.1 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
e66ecde93fa2ec3362c0d80aacc2270ad4b5882d4835444bff34223f6d6f5f51
BLAKE2b-256 checksum
How to use checksums
c0b0b768a59be46f633f1ada3f818de630c73265867dc8b0ff2a1e6dc2b80ffc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl

Download URL pygeodesic-0.1.11-cp310-cp310-macosx_10_9_x86_64.whl
Size 258.8 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
aad31c623cfe122cac223a7e603fc30ba6b8a56436d0a986fb1f60045c635e0c
BLAKE2b-256 checksum
How to use checksums
5d467b82ededbd6f5b1b1383053f88df5ffd16c66ed0623a8e778787458569bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp39-cp39-win_amd64.whl

Download URL pygeodesic-0.1.11-cp39-cp39-win_amd64.whl
Size 1.2 MB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
6c8fc3a92087e9757e0c4f7ebf8dd47cb031367bbf48c0277392c852b4b6e609
BLAKE2b-256 checksum
How to use checksums
5abcaa653f5c817213698e75be0006cd426dcebc29714685810b21bbafde2410
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL pygeodesic-0.1.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 877.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
4f46c00dd763ff6bebae6c5fc2437b115bd59d0a0b4f9d0158f36389680f1f1a
BLAKE2b-256 checksum
How to use checksums
0d918d037492bd6fc47edaac97a8bea86df8215a13c51063cdf3c3dd8ddc7373
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp39-cp39-macosx_11_0_arm64.whl

Download URL pygeodesic-0.1.11-cp39-cp39-macosx_11_0_arm64.whl
Size 143.7 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b98e74f6b22dce80c74ed1aa4fedc01ca1b13cd0b660fdeb2732a15cdaa28d6e
BLAKE2b-256 checksum
How to use checksums
5663c3ad7b8aca07942a9d6726145ce9838a5c27b22c5aaa99d554c5749bd330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pygeodesic-0.1.11-cp39-cp39-macosx_10_9_x86_64.whl

Download URL pygeodesic-0.1.11-cp39-cp39-macosx_10_9_x86_64.whl
Size 149.4 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
22606383c2de4d23c684508a23275e785759b34f78ea9b60222fe520277ab820
BLAKE2b-256 checksum
How to use checksums
cdeb8c8097db37f26883d0cad27eb6b8ddf1fbc1c71767a5da55b4086325822e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.11 This release

21 release files

0.1.9

21 release files

0.1.8

20 release files

0.1.7

4 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page