The GPX Surface Analyzer is a Python-based web application designed to analyze GPX tracks for their suitability for different types of biking, specifically road biking and gravel biking. It calculates:
- Surface Types: Breakdown of road surfaces along the route.
- Suitability Scores: Scores for road biking and gravel biking based on surface types.
- Elevation Data: Total elevation gain and loss along the route.
This tool is ideal for cyclists planning trips who need insights into route surfaces and elevation changes.
- Python 3.9 or newer
- Docker (if running the application in a container)
- Task (https://taskfile.dev/)
-
Clone the repository:
git clone https://github.com/kotaicode/gpx_analyzer cd gpx_analyzer
-
Install dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
-
The application will be available at
http://127.0.0.1:5000
.
-
Build the Docker image:
docker build -t gpx-surface-analyzer .
-
Run the Docker container:
docker run -p 5000:5000 gpx-surface-analyzer
-
Send a POST request to the
/analyze_surface
endpoint with a GPX file. Example usingcurl
:curl -X POST -F "gpx_file=@examples/069-gravelbike-track.gpx" http://127.0.0.1:5000/analyze_surface
-
The response will include:
- Surface Lengths: A breakdown of surface types and their respective lengths (in km).
- Suitability Scores: Scores for road and gravel biking.
- Elevation Data: Total elevation gain and loss (in meters).
Example Response:
{
"surface_lengths_km": {
"asphalt": 5.2,
"gravel": 3.7,
"unknown": 1.1
},
"suitability_scores": {
"roadbike": 0.8,
"gravelbike": 1.0
},
"elevation_data": {
"elevation_up": 120.5,
"elevation_down": 115.3
}
}
-
Extended Surface Support:
- Add more granular mapping for surface types.
- Improve handling of
unknown
surfaces by inferring based on context.
-
Performance Optimization:
- Cache Overpass API results for frequently queried areas.
- Optimize GPX parsing for large files.
-
Enhanced Suitability Metrics:
- Incorporate other factors like slope and weather conditions.
-
Frontend Integration:
- Build a web interface for uploading GPX files and visualizing results.
-
Custom OSM Support:
- Enable querying custom OpenStreetMap instances with user-provided data.
This project is licensed under the MIT License.