GPX/GIS Python Program

GPX CONVERTER

Tkinter Choose GPX Program Window





Gpx Converter uses Tkinter to open a file browser to select files for processing. You can:
* Convert a GPX file into a text(csv) and shape file
* Convert a shape file into a GPX file
* Convert a multitrack GPX file into a file with one track having multiple segments
* Break up a single line GPX file into multiple lines
* Round off GPX lat/lon coordinates

Gpx_converter.py was tested on Linux OS with Python 3.4.2 and Tkinter 8.5. I have not tested it on earlier versions of Python.

Tkinter
GPX Choose Arguments Window

GPX_Converter v42j. This version will set up the necessary folder (gpx_converter_42) and subfolders in your home directory and will create argument and option configuration files from default values. It will even create VRT files! Simply download and start to use it. You can customize various user preferences in the program USER_SETTINGS and in the config files (in the config subfolder). This version gives you the option of toggling: renaming output files, adding GPX date to the file name, add _1-_9 suffix to identical file names, and creating shapefiles. You can set the checkbox auto toggle in the USER_SETTINGS.

NOTE: The latest version (j) uses an option configuration file that is not compatible with earlier versions. An easy way to migrate to the latest version is to delete your current config file and let the program create a new one.

Button icons can be displayed by unzipping the image file (near bottom of this page) and placing the files in the image folder (created the first time you run the program).

System calls to cs2cs and ogr2ogr are built into the program. You need to have those programs installed on your computer. If you have QGIS or SAGA or GRASS installed on Linux then you are probably good to go.


You can run gpx_converter.py by using the command: python3 gpx_converter-42j.py

A sample waypoint CSV output is below. You can customize headings and columns.

Here is a zip file of images for the button display. You can use your own small .gif files for decoration. The images in the zip file are 16px x 16px. Download: images6buttons.tar.gz

If you are trouble shooting it works well to open the program in a terminal instead of using a launcher. The terminal will stay open and give you helpful error messages.

More information on using gpx2csv-shp.py can be found in hints.txt.

I've made a Python time converter function, time_to_time.py, that can be used independently from the gpx_converter.py program. It takes a GPX time string, <time>2016-09-08T19:01:46Z</time>, an input time zone integer, and an output time zone integer. The argument string just needs time units separated by something, not necessarily a GPX time format. The function returns Local Time in a tupel containing year, month, day, hour, minutes, seconds. You can convert a GPX UTC time string to your local time by using an input zone of 0 (UTC time zone) and an output zone that you want. Making this function was more fun than trying to figure out the Python library or external time libraries!