Skip to main content

spatialfriend

Python library for calculating geospatial data from gps coordinates.

Python 3.6 License


Table of Contents


Motivation

Determining one's elevation on Earth's surface has become a lot easier thanks to high-accuracy consumer GPS products and digital elevation models (DEMs) of Earth's topography. Still, there are errors in GPS location and in every Earth surface model. When working with elevation and position time series, for example calculating instantaneous slopes during a trail running workout, stricter requirements are placed on the data. Even with a perfectly accurate DEM, inaccurate GPS data can yield totally unreasonable elevation profiles and path slopes, documenting work or elevation gain that the runner did not actually do. The same can be said for a perfectly accurate GPS trace on an inaccurate DEM.

The goal of this project is to take GPS data of all resolutions, and return geospatial data and calculations that actually match the athlete's experience. No more unreasonably steep slopes or noisy data in your elevation profile making running power calculations meaningless. No more adding to your workout's distance because your GPS was drifting around while you were waiting at a stoplight. No more wondering if those elevation measurements you read on GPS device or barometric altimeter are accurate. No more apples to oranges data comparisons because of differences between devices or datasets.

This package is all about being able to hit record on that device, head out for your run/hike/bike ride, and forget about it. Bring that messy activity file and we will process the data once it is all done.


The Elevation Profile Smoothing Algorithm


Example

import spatialfriend as sf

Dependencies and Installation

Base Installation

GeoPy, Google Maps, NumPy, Pandas, and SciPy are required for the base installation.

pip install spatialfriend to install.

Extra: Elevaton values from .img files

In addition to providing access to the Google Maps Elevation query service, spatialfriend allows querying of user-owned .img files that contain elevation data. Such files are available from the National Map's download page.

GDAL and utm are required for this extra feature.

pip install spatialfriend[img] to install.

Extra: Elevation values from the National Map

spatialfriend allows querying of the National Map's Elevation Point Query Service. This service exposes data from the National Map's 1/3 arc-second Digital Elevation Model. 1/3 arc-second refers to the data's horizontal resolution in terms of degrees; this equates to roughly 30 meters.

requests and urllib3 are required for this extra feature.

pip install spatialfriend[tnm] to install.


Project Status

Complete

  • Create Python package.

  • Implement a series of tests to ensure functionality as development progresses.

Current Activities

  • Streamline input so user can be more hands-off.

Benchmarking and Optimization

  • Benchmark algorithm performance (speed, accuracy, and consistency):
    • Generate dummy series of (distance, elevation) data to check smoothing algorithm.
    • Generate series of GPS points to compare elevation datasets with and without smoothing.

Future Work

  • Implement an algorithm to smooth GPS position and speed data. Most GPS-enabled activity trackers filter their speed and distance timeseries to remove measurement noise. I want to try and figure out how they do it, then replicate their techniques, and compare the smoothed position data.

References


Contact

Reach out to me at one of the following places!


License

License

This project is licensed under the MIT License. See LICENSE file for details.


Metadata

Release files for spatialfriend 0.0.10

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

Source distribution (sdist)

Source distribution for spatialfriend 0.0.10
File Size Uploaded Provenance Actions
spatialfriend-0.0.10.tar.gz 9.6 kB Without provenance Details for spatialfriend-0.0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spatialfriend 0.0.10
File Interpreter ABI Platform Actions
spatialfriend-0.0.10-py3-none-any.whl Python 3 none any Details for spatialfriend-0.0.10-py3-none-any.whl

Total release size: 20.1 kB

Release files / spatialfriend-0.0.10.tar.gz

Download URL spatialfriend-0.0.10.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
27e931529c6213f53bb4b06ac36006a47d5b345462e91121ed8ca935a17fd389
BLAKE2b-256 checksum
How to use checksums
d2c9fa7f482f886031f6ce6a1e3f5c205f9626c44727bfb0509f524d8de2e6ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

Release files / spatialfriend-0.0.10-py3-none-any.whl

Download URL spatialfriend-0.0.10-py3-none-any.whl
Size 10.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5edc57fac6352401048903b5e88cec19bae8f12f696f6c575b620a7d4205b4d4
BLAKE2b-256 checksum
How to use checksums
2668b21c428e79e6ef90a7e49a176f2b929a3b683d51908122db2e2d7d284be8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.9

Security for spatialfriend 0.0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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