Debian Codegraph @

gpxpy.egg-info/PKG-INFO

raw
1 Metadata-Version: 2.1
2 Name: gpxpy
3 Version: 1.6.2
4 Summary: GPX file parser and GPS track manipulation library
5 Home-page: https://github.com/tkrajina/gpxpy
6 Author: Tomo Krajina
7 Author-email: [email protected]
8 License: Apache License, Version 2.0
9 Classifier: Programming Language :: Python
10 Classifier: Programming Language :: Python :: 3.6
11 Classifier: Programming Language :: Python :: 3.7
12 Classifier: Programming Language :: Python :: 3.8
13 Requires-Python: >=3.6
14 Description-Content-Type: text/markdown
15 License-File: LICENSE.txt
16 License-File: NOTICE.txt
17
18 [![Build Status](https://travis-ci.org/tkrajina/gpxpy.svg?branch=master)](https://travis-ci.org/tkrajina/gpxpy)
19 [![Coverage Status](https://coveralls.io/repos/github/tkrajina/gpxpy/badge.svg?branch=master)](https://coveralls.io/github/tkrajina/gpxpy?branch=master)
20
21 # gpxpy -- GPX file parser
22
23 This is a simple Python library for parsing and manipulating GPX files. GPX is an XML based format for GPS tracks.
24
25 You can see it in action on [my online GPS track editor and organizer](http://www.trackprofiler.com).
26
27 There is also a Golang port of gpxpy: [gpxgo](http://github.com/tkrajina/gpxgo).
28
29 See also [srtm.py](https://github.com/tkrajina/srtm.py) if your track lacks elevation data.
30
31 ## Usage
32
33 ```python
34 import gpxpy
35 import gpxpy.gpx
36
37 # Parsing an existing file:
38 # -------------------------
39
40 gpx_file = open('test_files/cerknicko-jezero.gpx', 'r')
41
42 gpx = gpxpy.parse(gpx_file)
43
44 for track in gpx.tracks:
45 for segment in track.segments:
46 for point in segment.points:
47 print(f'Point at ({point.latitude},{point.longitude}) -> {point.elevation}')
48
49 for waypoint in gpx.waypoints:
50 print(f'waypoint {waypoint.name} -> ({waypoint.latitude},{waypoint.longitude})')
51
52 for route in gpx.routes:
53 print('Route:')
54 for point in route.points:
55 print(f'Point at ({point.latitude},{point.longitude}) -> {point.elevtion}')
56
57 # There are many more utility methods and functions:
58 # You can manipulate/add/remove tracks, segments, points, waypoints and routes and
59 # get the GPX XML file from the resulting object:
60
61 print('GPX:', gpx.to_xml())
62
63 # Creating a new file:
64 # --------------------
65
66 gpx = gpxpy.gpx.GPX()
67
68 # Create first track in our GPX:
69 gpx_track = gpxpy.gpx.GPXTrack()
70 gpx.tracks.append(gpx_track)
71
72 # Create first segment in our GPX track:
73 gpx_segment = gpxpy.gpx.GPXTrackSegment()
74 gpx_track.segments.append(gpx_segment)
75
76 # Create points:
77 gpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(2.1234, 5.1234, elevation=1234))
78 gpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(2.1235, 5.1235, elevation=1235))
79 gpx_segment.points.append(gpxpy.gpx.GPXTrackPoint(2.1236, 5.1236, elevation=1236))
80
81 # You can add routes and waypoints, too...
82
83 print('Created GPX:', gpx.to_xml())
84 ```
85
86 ## GPX version
87
88 gpx.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!
89
90 Be 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.
91
92 For 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.
93
94 ## GPX extensions
95
96 gpx.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.
97
98 ## XML parsing
99
100 If 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.
101
102 The 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`.
103
104 ## GPX max speed
105
106 Gpxpy 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).
107
108 "Raw" max speed can be calculated with:
109
110 moving_data = gpx.get_moving_data(raw=True)
111
112 ## Pull requests
113
114 Branches:
115
116 * `master` contains the code of the latest release
117 * `dev` branch is where code for the next release should go.
118
119 Send your pull request against `dev`, not `master`!
120
121 Before sending a pull request -- check that all tests are OK. Run all the static typing checks and unit tests with:
122
123 $ make mypy-and-tests
124
125 Run a single test with:
126
127 $ python3 -m unittest test.GPXTests.test_haversine_and_nonhaversine
128
129 Gpxpy runs only with python 3.6+. The code must have type hints and must pass all the mypy checks.
130
131 ## GPX tools
132
133 Additional command-line tools for GPX files can be downloaded here <https://github.com/tkrajina/gpx-cmd-tools> or installed with:
134
135 ```
136 pip install gpx-cmd-tools
137 ```
138
139 ## License
140
141 GPX.py is licensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)
142