Package: gpxo
AboutLoad GPS data from GPX files into Python as a numpy arrays andpandasDataFrames. Initial parsing done using thegpxpypackage. Trajectory plotting on a map available usingmplleaflet.Quick StartInstallpipinstallgpxoLoad Trackimportgpxotrack=gpxo.Track('ExampleTrack.gpx')(it is possible to indicate which track or segment to consider during instantiation, by default it is the first one).track.datais apandasDataFrame containing time, position, elevation etc.; usualpandasmethods can be used to analyze, manipulate and plot data. Individual columns are also available as numpy arrays as attributes of the class (see below).Detailed ContentsTrack classLoad, inspect and plot GPX data using theTrackclass, with the following methods and attributes.Methodssmooth(): smooth position and elevation data (seegpxo.smooth()below),plot(): plot trajectory data using a combination of shortnames (see shortnames below); also takesmatplotlib.pyplot.plot()arguments/kwargs,map(): plot trajectory on a map, usingmplleaflet.show(),closest_to(): find index of point in trajectory closest to a (lat, long) point.Basic Attributes(some may not be available depending on actual data present in the GPX file)latitude(numpy array): latitude in °,longitude(numpy array): longitude in °,elevation(numpy array): elevation in meters,time(numpy array): local time expressed as a datetime.datetime.Property attributes(Read-only, and calculated/updated from basic attributes; some may not be available depending on actual data present in the GPX file)seconds(numpy array): total number of seconds since beginning of track,distance(numpy array): total distance (km) since beginning of track,velocity(numpy array): instantaneous velocity (km/h),compass(numpy array): instantaneous compass bearing (°),data(pandas DataFrame): all above attributes in a single dataframe.MiscellaneousOutside of theTrackclass, the following standalone function is also available:compass(pt1, pt2): compass bearing (°) between pt1 (lat1, long1) and pt2 (lat2, long2),closest_pt(pt, trajectory): index of closest pt in trajectory (latitudes, longitudes) to specified pt (lat, long),smooth(x, n, window): smooth 1-d array with a moving window of size n and typewindow.Short namesShort nameCorresponding datattimesduration (s)ddistance (km)vvelocity (km/h)zelevation (m)ccompass (°)ExamplesSee Jupyter NotebookExamples.ipynb(https://github.com/ovinc/gpxo/blob/master/Examples.ipynb) for a detailed example using real GPX data.Quick example: show the path of a GPX file on a map with color-coding corresponding to elevation:importgpxotrack=gpxo.Track('ExampleTrack.gpx')track.map(plot='scatter',c=track.elevation,cmap='plasma')TroubleshootingIn case of the following error:'XAxis' object has no attribute '_gridOnMajorwhen using themap()method, try downgrading Matplotlib to version <= 3.3.2 or install a forked version of mplleaflet (seehttps://github.com/jwass/mplleaflet/issues/75).InformationRequirementsPython >= 3.6Dependencies(automatically installed by pip if necessary)numpypandasmatplotlibimportlib-metadatagpxpy(https://github.com/tkrajina/gpxpy)vincenty(https://github.com/maurycyp/vincenty)mplleaflet(https://github.com/jwass/mplleaflet)AuthorOlivier Vincent(ovinc.py@gmail.com)LicenseBSD 3-Clause (seeLICENCEfile)BSD 3-Clause LicenseCopyright (c) 2020, Olivier VINCENT
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.