Skip to main content

gpx-converter

gpx-converter-icon

https://img.shields.io/pypi/v/gpx-converter.svg https://img.shields.io/travis/nidhaloff/gpx-converter.svg Documentation Status PyPI - Wheel https://pepy.tech/badge/gpx-converter PyPI - License Twitter URL

GPX manipulation for humans

Python package for manipulating gpx files and easily convert gpx to other different formats.

When & Why

  • You need to convert GPX to other formats

  • You need to convert other formats like csv to GPX

  • You want to interpolate the GPX coordinates

  • High level of abstraction

  • Stable API

  • easy to use and to extend

Motivation

I decided to create this project because I had gpx data that I needed to manipulate. I searched for a python package for this but I did not find what I was looking for, therefore I created the gpx-converter package to make gpx files manipulation very easy. Furthermore, the package contains methods for applying interpolation on the gpx data. This feature was very helpful for me since I also needed to interpolate the gpx data and convert it to csv. Feel free to contribute or to give me feedback anytime :)

Features

  • Convert gpx files to other formats such as csv, numpy arrays, dataframes, excel and json

  • Convert csv files to gpx

  • Apply interpolation on the gpx data

Installation

$ pip install -U gpx-converter

Quick Usage

from gpx_converter import Converter

Just read the gpx to dictionary

dic = Converter(input_file='your_input.gpx').gpx_to_dictionary(latitude_key='latitude', longitude_key='longitude')
# now you have a dictionary and can access the longitudes and latitudes values from the keys
latitudes = dic['latitude']
longitudes = dic['longitude']

Convert GPX to other formats

  • Convert from gpx to csv:

Converter(input_file='your_input.gpx').gpx_to_csv(output_file='your_output.csv')
  • Convert from gpx to excel sheets:

Converter(input_file='your_input.gpx').gpx_to_excel(output_file='your_output.xlsx')
  • Convert from gpx to json:

Converter(input_file='your_input.gpx').gpx_to_json(output_file='your_output.json)
  • Convert gpx file to dataframe:

df = Converter(input_file='your_input.gpx').gpx_to_dataframe()
  • Convert gpx file to numpy array:

np_array = Converter(input_file='your_input.gpx').gpx_to_numpy_array()

Now convert other formats to GPX

  • csv to gpx

Converter(input_file='your_input.csv').csv_to_gpx(lats_colname='column_name_of_latitudes',
                                                 longs_colname='column_name_of_longitudes',
                                                 output_file='your_output.gpx')
  • excel to gpx

Converter(input_file='your_input.xlsx').excel_to_gpx(lats_colname='column_name_of_latitudes',
                                                 longs_colname='column_name_of_longitudes',
                                                 output_file='your_output.gpx')
  • dataframe to gpx (notice that the method is static)

Converter.dataframe_to_gpx(input_df=your_df,
                           lats_colname='column_name_of_latitudes',
                           longs_colname='column_name_of_longitudes',
                           output_file='your_output.gpx')
  • json to gpx

Converter(input_file='your_input.json').json_to_gpx(input_df=your_df,
                                                   lats_colname='column_name_of_latitudes',
                                                   longs_colname='column_name_of_longitudes',
                                                   output_file='your_output.gpx')
  • Automate the conversion of multiple csv file to gpx:

Converter.convert_multi_csv_to_gpx(dirpath='your_directory/')
  • Apply spline interpolation on gpx file (you need to install scipy for this to work):

interpolated_coordinates = Converter.spline_interpolation(cv=your_array_of_control_vertices)

Usage from terminal

Alternatively you can use the gpx_converter directly from terminal. You just need to pass the function, input file and output file as arguments.

  • function: the conversion method you want to use. For example “gpx_to_csv”

  • input file: path to your input file

  • output file: path to your output file

$ gpx_converter --function "gpx_to_csv" --input_file "home/your_input.gpx" --output_file "home/your_output.csv"

or maybe you prefer the short version

$ gpx_converter -func "gpx_to_csv" -in "home/your_input.gpx" -out "home/your_output.csv"

Contributions

Contributions are always welcome. Make sure you check the guidlines first https://gpx-converter.readthedocs.io/en/latest/contributing.html

Metadata

Release files for gpx-converter 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpx-converter 2.1.0
File Size Uploaded
gpx_converter-2.1.0.tar.gz 18.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gpx-converter 2.1.0
File Interpreter ABI Platform
gpx_converter-2.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 26.7 kB

Release files / gpx_converter-2.1.0.tar.gz

Download URL gpx_converter-2.1.0.tar.gz
Size 18.5 kB
Tags Source
SHA-256 checksum
How to use checksums
77d32230c04d4871ffdf91bf9135ef62caf4f04903f3e479c5313c9b47531fbe
BLAKE2b-256 checksum
How to use checksums
aa0a8a919957b0359738a9b40b335deaf84340764f01d1973174d6ab66f97fe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.10

Release files / gpx_converter-2.1.0-py2.py3-none-any.whl

Download URL gpx_converter-2.1.0-py2.py3-none-any.whl
Size 8.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
347097cc1e99afc2b42b9fa721d4f4904fb84cfe90a1790ad3be09d75ef8491f
BLAKE2b-256 checksum
How to use checksums
e8036b2f1a65998738a962f38e2bc2f6f5e8875310b62910108cadc11836f06d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files

2.0.0

2 release files

1.7.4

2 release files

1.7.3

2 release files

1.7.2

2 release files

1.7.1

2 release files

1.7.0

2 release files

1.6.9

2 release files

1.6.8

2 release files

1.6.7

2 release files

1.6.6

2 release files

1.6.5

2 release files

1.6.4

2 release files

1.6.3

2 release files

1.6.2

2 release files

1.6.1

2 release files

1.6.0

2 release files

1.5

2 release files

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page