Skip to main content

PyGPX is a Python package that brings support for reading, writing and

Project description

PyGPX

PyPI Supported Python Versions pre-commit.ci status Documentation Status PyPI - License

PyGPX is a Python package that brings support for reading, writing and converting GPX files.

Installation

From PyPI

PyGPX is available on PyPI. Install with pip or your package manager of choice:

pip install gpx

From source

If you'd like, you can also install PyGPX from source (with flit):

git clone https://github.com/sgraaf/gpx.git
cd gpx
python3 -m pip install flit
flit install

Documentation

Check out the PyGPX documentation for the User's Guide and API Reference.

Usage

Reading a GPX file

>>> from gpx import GPX
>>> # read the GPX data from file
>>> gpx = GPX.from_file("path/to/file.gpx")
>>> # print the bounds of the GPX data
>>> print(gpx.bounds)

Manipulating GPX data

>>> from gpx import Waypoint
>>>
>>> # delete the last waypoint
>>> del gpx.waypoints[-1]
>>>
>>> # add a new waypoint
>>> wpt = Waypoint()
>>> wpt.latitude = 52.123
>>> wpt.longitude = 4.123
>>> gpx.waypoints.append(wpt)

Writing a GPX file

>>> # write the GPX data to a file
>>> gpx.to_file("path/to/file.gpx")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gpx-0.2.1.tar.gz (35.3 kB view hashes)

Uploaded Source

Built Distribution

gpx-0.2.1-py3-none-any.whl (37.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page