This Python script converts Garmin TCX files to GPX format. The script processes a directory of .tcx files and generates corresponding .gpx files in the same directory.
- Batch Processing: Converts all
.tcxfiles in a specified directory to.gpxfiles. - Data Extraction: Extracts latitude, longitude, elevation, and time information from TCX files and formats them into the GPX standard.
- Clean XML Handling: Ensures that the XML content from the TCX files is clean and well-formed before processing.
Before you begin, ensure you have the following installed:
- Python 3.x
lxmllibrary (for XML processing)
You can install the lxml library using pip:
pip install lxml-
Clone the Repository:
Clone the repository to your local machine.
git clone https://github.com/yourusername/tcx-to-gpx-converter.git cd tcx-to-gpx-converter -
Run the Script:
Execute the script by running the following command:
python tcx_to_gpx.py
You will be prompted to enter the directory containing your
.tcxfiles. -
Provide Directory Path:
Input the full path to the directory that contains the
.tcxfiles you wish to convert. The script will process each.tcxfile in the directory and create a corresponding.gpxfile. -
Check the Output:
The
.gpxfiles will be saved in the same directory as the.tcxfiles, with the same base name.
If you have a directory /path/to/tcx_files/ containing activity1.tcx and activity2.tcx, after running the script, you will find:
/path/to/tcx_files/activity1.gpx/path/to/tcx_files/activity2.gpx
If the script encounters any errors while processing a file, it will print an error message and continue processing the next file.
Feel free to submit issues or fork this repository and submit pull requests to improve the script.
This project is licensed under the MIT License. See the LICENSE file for details.
This README provides instructions on how to install and use the script, as well as an overview of its functionality. Feel free to customize this document to suit your specific needs.