Add hydration points to your GPX tracks automatically π΄ββοΈπ§
Thirsty is a Python tool that enhances your GPX files by adding Points of Interest (POIs), particularly drinking water and foods points, to your cycling or running routes. It integrates with the Overpass API to query OpenStreetMap for relevant points along your route and adds them to the GPX file. Ideal for long-distance cycling events, ultra races, or any activity where hydration points matter!
This script is a fork of the original script from jsleroy.
This version allows you to process a GPX file containing 30,000 points and a route of over 1,000 kilometers in less than a minute on most computers. This is a niche use case that should only concern people preparing for multi-day ultracycling events.
- Query Overpass API: Fetch drinking water POIs from OpenStreetMap.
- Bounding Box Filtering: Filter POIs around a defined area to match your GPX route.
- Distance-based Filtering: Ensures POIs are within a defined proximity of your GPX track.
- Supports GPX from URL and Local Files: Easily work with GPX files from your device or download them from a URL.
- In-Memory Handling: No need for temporary files; everything is handled in memory for speed.
- Progress Bar: Monitor download and processing progress with the
richmodule.
- Ultra distance: Support for routes covering thousands of kilometers.
- Bakery, CafΓ©, and Pizza robot: more points of interest supported.
By default, Thirsty searches for all supported POIs.
You can customize which types of potable water points you want to add using the --poi-type (or -p) option.
- You can specify one or more POI types by repeating the
-poption. - If no
-poption is specified, All available POIs will be used automatically.
| POI Type | Description |
|---|---|
drinking_water |
Public drinking water fountains (default). |
water_point |
Water refill stations for caravans, RVs, or marinas (only potable ones). |
water_tap |
Taps providing potable water. |
spring |
Natural springs with potable water. |
fountain |
Public decorative fountains explicitly marked as potable. |
bakery |
Bakery |
cafe |
Cafe |
fuel_convenience |
Gas station with a convenience store |
convenience_store |
Conveniance store |
pizza_vending |
24-hour pizza vending machine |
Use default drinking water points:
thirsty -i trace.gpx -o trace_with_poi.gpxUse only springs and water taps:
thirsty -i trace.gpx -o trace_with_poi.gpx -p spring -p tapIf an invalid POI type is provided, the program will display an error message and exit.
Clone this repository and set up a virtual environment:
git clone https://github.com/berettavexee/thirsty
cd thirsty
python3 -m venv venv
source venv/bin/activateInstall the dependencies:
pip install .This example shows how to download a GPX file from a URL, add drinking water POIs to the route, and save the modified GPX to an output file.
thirsty https://example.com/yourfile.gpx output.gpx --distance 150- URL or Local GPX: Supports both local files and downloading from a URL.
- Distance: Optionally specify the maximum distance (in meters) from the track for POIs (default: 100 meters).
You can also process a local GPX file:
thirsty input.gpx output.gpx --distance 150- Queries the Overpass API for drinking water POIs within the bounding box of the GPX file's route.
- Filters POIs that are within a specified distance from the GPX track. This ensures that only nearby POIs are added to the GPX file.
- Both downloaded and local GPX files are handled entirely in memory, eliminating the need for temporary files and speeding up the process.
- During the download process, the script shows a progress bar (using the
richlibrary) so you can track the download status in real-time.
- The Overpass API does not allow queries on very large areas or returning very long lists of results. Areas that are too large are recursively divided into sub-areas.
- Only sub-areas through which the route passes are requested via the overpass API.
- The initial search area (Bounding Box) has been expanded to take into account the search radius. Important if you want to set up large search radius.
- A KD Tree is used to quickly find the nearest neighbor before calculating the distance between a POI and the route. This is an important optimization for long routes.
- Python 3.7+
requests: For HTTP requests to Overpass API and downloading GPX files.gpxpy: For reading and writing GPX files.rich: For the progress bar and rich text output.scipy: For faster filtering (KD Tree)
python3 -m venv venv
source venv/bin/activate
pip install -e .You can run the script directly from the command line. Make sure to provide the appropriate input parameters (either a local file or a URL) and specify the output file:
thirsty input.gpx output.gpx --distance 150- Fork this repository and create a new branch.
- Make your changes and commit them.
- Push your changes to your fork.
- Create a Pull Request with a detailed description of your changes.
This project is licensed under the GNU GPL v3 License.



