{"id":13469354,"url":"https://github.com/tkrajina/gpxpy","last_synced_at":"2025-05-13T20:19:58.837Z","repository":{"id":1072246,"uuid":"913279","full_name":"tkrajina/gpxpy","owner":"tkrajina","description":"gpx-py is a python GPX parser. GPX (GPS eXchange Format) is an XML based file format for GPS tracks.","archived":false,"fork":false,"pushed_at":"2024-11-24T15:49:45.000Z","size":1404,"stargazers_count":1059,"open_issues_count":36,"forks_count":224,"subscribers_count":40,"default_branch":"dev","last_synced_at":"2025-04-28T11:59:39.049Z","etag":null,"topics":["gps","gpx","gpx-library","python","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkrajina.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-09-15T18:42:28.000Z","updated_at":"2025-04-16T13:25:43.000Z","dependencies_parsed_at":"2023-07-05T19:34:20.263Z","dependency_job_id":"8fb7fd1b-aaa8-40e7-94c3-256278a8bbdd","html_url":"https://github.com/tkrajina/gpxpy","commit_stats":{"total_commits":715,"total_committers":58,"mean_commits":"12.327586206896552","dds":"0.38601398601398607","last_synced_commit":"2c76d82ad2371ecfd79b00b010ad1f4767ee6b87"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrajina%2Fgpxpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrajina%2Fgpxpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrajina%2Fgpxpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkrajina%2Fgpxpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkrajina","download_url":"https://codeload.github.com/tkrajina/gpxpy/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020660,"owners_count":22000757,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gps","gpx","gpx-library","python","python3"],"created_at":"2024-07-31T15:01:35.599Z","updated_at":"2025-05-13T20:19:58.813Z","avatar_url":"https://github.com/tkrajina.png","language":"Python","readme":"[![Run Tests](https://github.com/tkrajina/gpxpy/actions/workflows/test.yml/badge.svg)](https://github.com/tkrajina/gpxpy/actions/workflows/test.yml)\n\n# gpxpy -- GPX file parser\n\nThis is a simple Python library for parsing and manipulating GPX files. GPX is an XML based format for GPS tracks.\n\nYou can see it in action on [my online GPS track editor and organizer](http://www.trackprofiler.com).\n\nThere is also a Golang port of gpxpy: [gpxgo](http://github.com/tkrajina/gpxgo).\n\nSee also [srtm.py](https://github.com/tkrajina/srtm.py) if your track lacks elevation data.\n\n## Usage\n\n```python\nimport gpxpy\nimport gpxpy.gpx\n\n# Parsing an existing file:\n# -------------------------\n\ngpx_file = open('test_files/cerknicko-jezero.gpx', 'r')\n\ngpx = gpxpy.parse(gpx_file)\n\nfor track in gpx.tracks:\n    for segment in track.segments:\n        for point in segment.points:\n            print(f'Point at ({point.latitude},{point.longitude}) -\u003e {point.elevation}')\n\nfor waypoint in gpx.waypoints:\n    print(f'waypoint {waypoint.name} -\u003e ({waypoint.latitude},{waypoint.longitude})')\n\nfor route in gpx.routes:\n    print('Route:')\n    for point in route.points:\n        print(f'Point at ({point.latitude},{point.longitude}) -\u003e {point.elevtion}')\n\n# There are many more utility methods and functions:\n# You can manipulate/add/remove tracks, segments, points, waypoints and routes and\n# get the GPX XML file from the resulting object:\n\nprint('GPX:', gpx.to_xml())\n\n# Creating a new file:\n# --------------------\n\ngpx = gpxpy.gpx.GPX()\n\n# Create first track in our GPX:\ngpx_track = gpxpy.gpx.GPXTrack()\ngpx.tracks.append(gpx_track)\n\n# Create first segment in our GPX track:\ngpx_segment = gpxpy.gpx.GPXTrackSegment()\ngpx_track.segments.append(gpx_segment)\n\n# Create points:\ngpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(2.1234, 5.1234, elevation=1234))\ngpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(2.1235, 5.1235, elevation=1235))\ngpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(2.1236, 5.1236, elevation=1236))\n\n# You can add routes and waypoints, too...\n\nprint('Created GPX:', gpx.to_xml())\n```\n\n## GPX version\n\ngpx.py can parse and generate GPX 1.0 and 1.1 files. The generated file will always be a valid XML document, but it may not be (strictly speaking) a valid GPX document. For example, if you set gpx.email to \"my.email AT mail.com\" the generated GPX tag won't confirm to the regex pattern. And the file won't be valid. Most applications will ignore such errors, but... Be aware of this!\n\nBe aware that the gpxpy object model *is not 100% equivalent* with the underlying GPX XML file schema. That's because the library object model works with both GPX 1.0 and 1.1.\n\nFor example, GPX 1.0 specified a `speed` attribute for every track point, but that was removed in GPX 1.1. If you parse GPX 1.0 and serialize back with `gpx.to_xml()` everything will work fine. But if you have a GPX 1.1 object, changes in the `speed` attribute will be lost after `gpx.to_xml()`. If you want to force using 1.0, you can `gpx.to_xml(version=\"1.0\")`. Another possibility is to use `extensions` to save the speed in GPX 1.1.\n\n## GPX extensions\n\ngpx.py preserves GPX extensions. They are stored as [ElementTree](https://docs.python.org/2/library/xml.etree.elementtree.html#module-xml.etree.ElementTree) DOM objects. Extensions are part of GPX 1.1, and will be ignored when serializing a GPX object in a GPX 1.0 file.\n\n## XML parsing\n\nIf lxml is available, then it will be used for XML parsing, otherwise minidom is used. Lxml is 2-3 times faster so, if you can choose -- use it.\n\nThe GPX version is automatically determined when parsing by reading the version attribute in the gpx node. If this attribute is not present then the version is assumed to be 1.0. A specific version can be forced by setting the `version` parameter in the parse function. Possible values for the 'version' parameter are `1.0`, `1.1` and `None`.\n\n## GPX max speed\n\nGpxpy is a GPX parser and by using it you have access to all the data from the original GPX file. The additional methods to calculate stats have some additional heuristics to remove common GPS errors. For example, to calculate `max_speed` it removes the top `5%` of speeds and points with nonstandard distance (those are usually GPS errors).\n\n\"Raw\" max speed can be calculated with:\n\n    moving_data = gpx.get_moving_data(raw=True)\n\n## Pull requests\n\nBranches:\n\n* `master` contains the code of the latest release\n* `dev` branch is where code for the next release should go.\n\nSend your pull request against `dev`, not `master`!\n\nBefore sending a pull request -- check that all tests are OK.  Run all the static typing checks and unit tests with:\n\n    $ make mypy-and-tests\n\nRun a single test with:\n\n    $ python3 -m unittest test.GPXTests.test_haversine_and_nonhaversine\n\nGpxpy runs only with python 3.6+. The code must have type hints and must pass all the mypy checks.\n\n## GPX tools\n\nAdditional command-line tools for GPX files can be downloaded here \u003chttps://github.com/tkrajina/gpx-cmd-tools\u003e or installed with:\n\n```\npip install gpx-cmd-tools\n```\n\n## License\n\nGPX.py is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\n","funding_links":[],"categories":["Python","Software 💻"],"sub_categories":["Wrestling 🤼‍♀️"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkrajina%2Fgpxpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkrajina%2Fgpxpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkrajina%2Fgpxpy/lists"}