Extract GPS data from photos and create GPX files
Project description
PixTrail
PixTrail is a simple yet powerful tool that extracts the GPS information stored in your photos' EXIF metadata and converts it into standard GPX format that can be used in various mapping applications, allowing you to visualize and share your journeys.
The Story Behind PixTrail
As an avid photographer, I've always enjoyed using the Photos app on iOS and macOS to organize and relive my journeys. While these tools are great for managing photos, I found myself wishing for a way to reconstruct the routes I had taken during day trips or longer journeys based on the photos I captured along the way.
I wanted to see the path I wandered through a city, the trails I hiked in the mountains, or the roads I traveled during a vacation - all visualized on a map using the GPS data already embedded in my photos. This desire to connect my photographic memories with their geographic context led to the creation of PixTrail.
Features
- Extract GPS coordinates and timestamps from EXIF metadata in photos
- Generate GPX files with waypoints and tracks
- Support for various image formats: JPG, PNG, TIFF, BMP
- Support for various RAW formats: CR2, NEF, ARW, ORF, RW2, PEF, SRW, DNG (Canon, Nikon, Sony, Olympus, Panasonic, Pentax, Samsung, digital negative)
- Command-line interface for easy use
- Web interface for browser-based operation
- Support for recursive directory processing
- Visualize routes on OpenStreetMap
Privacy
PixTrail processes all photo metadata locally on your device. No data is uploaded to any server, shared with third parties, or sent anywhere outside your computer. Your location data and photos remain completely private and under your control at all times.
Installation
Basic Installation
pip install pixtrail
Installation with Web Interface
pip install pixtrail[web]
Install from Source
git clone https://github.com/sukitsubaki/pixtrail.git
cd pixtrail
pip install -e .
Usage
Command Line
# Basic usage
pixtrail -i /path/to/photos
# Specify output file
pixtrail -i /path/to/photos -o /path/to/output.gpx
# Search recursively in subdirectories
pixtrail -i /path/to/photos -r
# Enable verbose output
pixtrail -i /path/to/photos -v
# Batch process multiple directories
pixtrail -b /path/to/photos1 /path/to/photos2 /path/to/photos3
# Batch process with a common output directory
pixtrail -b /path/to/photos1 /path/to/photos2 -d /path/to/gpx_output
# Start the web interface
pixtrail -w
# Start the web interface on a specific host and port
pixtrail -w --host 0.0.0.0 --port 8080
# Start the web interface without automatically opening a browser
pixtrail -w --no-browser
Web Interface
The web interface provides a user-friendly way to upload photos, extract GPS data, visualize routes on a map, and download GPX files:
-
Start the web interface:
pixtrail -w -
Your browser will automatically open to the PixTrail interface
-
Upload your photos using the file selector
-
PixTrail will process the photos and display the route on a map
-
Download the GPX file for use in other applications
Python API
from pixtrail.core import PixTrail
# Create a PixTrail object
pt = PixTrail()
# Process a directory of images
gps_data = pt.process_directory("/path/to/photos", recursive=True)
# Generate a GPX file
pt.generate_gpx("/path/to/output.gpx")
# Or do both in one step
pt.process_and_generate("/path/to/photos", "/path/to/output.gpx", recursive=True)
Requirements
- Python 3.6 or newer
- exifread
- gpxpy
- Pillow
- Flask (for web interface)
Example
After running PixTrail on a directory of geotagged photos, you'll get a GPX file that can be imported into mapping software like:
- OpenStreetMap
- Google Earth
- GPX viewers
- Mapping applications on smartphones and GPS devices
Future Roadmap
Here are some features we're planning to add in future releases:
- Time-based Filtering: Process only photos within specific time windows
- Route Smoothing: Algorithm to reduce GPS inaccuracies
- Statistics: Calculate and display statistics like total distance, average speed, elevation profile
- Video Support: Extract GPS data from video files
- Map Enhancements:
- Support for multiple map providers
- Customizable map styles
- More detailed route information
Contributing
Contributions and suggestions for additional features are welcome! Here's how you can help:
- Bug Reports: If you encounter any issues, please open an issue on GitHub with details about the problem, including steps to reproduce it.
- Feature Requests: Have an idea for a new feature? Feel free to create an issue describing your suggestion.
- Code Contributions: Want to contribute code? Fork the repository, make your changes, and submit a pull request.
- Documentation: Help improve the documentation by fixing errors or adding examples.
Please follow these guidelines when contributing:
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
- Keep pull requests focused on a single change
Development Setup
# Clone the repository
git clone https://github.com/sukitsubaki/pixtrail.git
cd pixtrail
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev,web]"
# Run tests
pytest
License
- This project is licensed under the MIT License by Suki Tsubaki.
- The example photos are licensed under CC BY 4.0 by Anil Öztas.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pixtrail-2.0.0.tar.gz.
File metadata
- Download URL: pixtrail-2.0.0.tar.gz
- Upload date:
- Size: 25.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
049ffaff393ae7d37a87fbbdaaac7d684d2ff70b08e681a5044fb2deef0f5244
|
|
| MD5 |
54de73f2c2daed15c765df2bcf61da74
|
|
| BLAKE2b-256 |
071d1498b02fb4f263215f96eb55c17eaf1421a3170dab774c851625bbaafe2f
|
File details
Details for the file pixtrail-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pixtrail-2.0.0-py3-none-any.whl
- Upload date:
- Size: 28.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7f2770170a325efabb11e6c65720362d24712a8f7531e1998e1bae2cc2afe61c
|
|
| MD5 |
058200489b8a90b837741a43961aa738
|
|
| BLAKE2b-256 |
53e8b5ce2ad6cb7aa1d94b099d4f52ded264e93bb53dda6be685ea75c4bc89d9
|