GithubHelp home page GithubHelp logo

faballemand / ezgpx Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 1.0 21.22 MB

Python GPX library

License: GNU General Public License v3.0

Python 90.96% HTML 9.04%
gpx gpx-data gpx-files gpx-library gpx-parser gpx-reader gpx-writer python fit kml kmz

ezgpx's Introduction

πŸ—ΊοΈ ezGPX

GitHub PyPI - Version GitHub last commit Documentation Status PyPI - Downloads

πŸ”Ž Description

Easy to use Python GPX library.

πŸ› οΈ Installation

pip install ezgpx

🏁 Get started

import ezgpx
import matplotlib

# Parse GPX file
gpx = ezgpx.GPX("file.gpx")

# Simplify (using Ramer-Dougle-Peucker algorithm)
gpx.simplify()

# Remove metadata
gpx.remove_metadata()

# Plot with Matplotlib
test_gpx.matplotlib_plot(figsize=(16,9),
                         size=6,
                         color="ele",
                         cmap=matplotlib.cm.get_cmap("gnuplot", 12),
                         colorbar=False,
                         start_point_color="green",
                         stop_point_color="red",
                         way_points_color=None,
                         background="World_Imagery",
                         offset_percentage=0.04,
                         dpi=100,
                         title=test_gpx.name(),
                         title_fontsize=20,
                         watermark=True,
                         file_path="img_1.png")

# Write new simplified GPX file
gpx.to_gpx("new_file.gpx")

πŸ‹οΈ Advanced Use

import ezgpx
import matplotlib

# Parse GPX file
gpx = ezgpx.GPX("file.gpx")

# Plot with Matplotlib
test_gpx.expert_plot(figsize=(16,9),
                     subplots=(3,2),
                     map_position=(0,0),
                     map_size=10,
                     map_color="ele",
                     map_cmap=matplotlib.cm.get_cmap("viridis", 12),
                     map_colorbar=True,
                     start_point_color=None,
                     stop_point_color=None,
                     way_points_color=None,
                     background="World_Imagery",
                     offset_percentage=0.04,
                     xpixels=1000,
                     ypixels=None,
                     dpi=100,
                     elevation_profile_position=(1,0),
                     elevation_profile_size=10,
                     elevation_profile_color="ele",
                     elevation_profile_cmap=matplotlib.cm.get_cmap("viridis", 12),
                     elevation_profile_colorbar=False,
                     elevation_profile_grid=True,
                     elevation_profile_fill_color="lightgray",
                     elevation_profile_fill_alpha=0.5,
                     pace_graph_position=(2,0),
                     pace_graph_size=10,
                     pace_graph_color="ele",
                     pace_graph_cmap=None,
                     pace_graph_colorbar=False,
                     pace_graph_grid=True,
                     pace_graph_fill_color="lightgray",
                     pace_graph_fill_alpha=0.5,
                     pace_graph_threshold=15,
                     ascent_rate_graph_position=(1,1),
                     made_with_ezgpx_position=(0,1),
                     shared_color="ele",
                     shared_cmap=None,
                     shared_colorbar=True,
                     data_table_position=(2,1),
                     title=test_gpx.name(),
                     title_fontsize=20,
                     watermark=False,
                     file_path="img_2.png")

πŸ‘€ Author

  • Fabien ALLEMAND

ezgpx's People

Contributors

faballemand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

ezgpx's Issues

No module named 'importlib_resources' error when importing ezgpx

Description
Error is triggered when I try to import ezGPX module.

Setup

  • Python version 3.11 running on a conda environment
  • ezgpx version 0.2.0
  • Code executed on jupyter lab version 4.0.11

Step to reproduce
Run the following code:

import ezgpx

Error

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[8], line 1
----> 1 import ezgpx.__version__ as v

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/__init__.py:1
----> 1 from .fit_parser import *
      2 from .gpx import *
      3 from .gpx_elements import *

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/fit_parser/__init__.py:1
----> 1 from .fit_parser import *

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/fit_parser/fit_parser.py:10
      6 from math import pi
      8 from fitparse import FitFile
---> 10 from ..parser import Parser, DEFAULT_PRECISION
     11 from ..gpx_elements import Bounds, Copyright, Email, Extensions, Gpx, Link, Metadata, Person, Point, PointSegment, Route, TrackSegment, Track, WayPoint
     13 class FitParser(Parser):

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/parser/__init__.py:1
----> 1 from .parser import *

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/parser/parser.py:4
      1 from typing import Optional, Union
      2 import logging
----> 4 from ..gpx_elements import Gpx
      6 DEFAULT_PRECISION = 10
      7 DEFAULT_TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ"

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/gpx_elements/__init__.py:5
      3 from .email import *
      4 from .extensions import *
----> 5 from .gpx import *
      6 from .link import *
      7 from .metadata import *

File ~/miniconda3/envs/gpx/lib/python3.11/site-packages/ezgpx/gpx_elements/gpx.py:2
      1 import os
----> 2 from importlib_resources import files
      3 from typing import Union, List, Tuple
      4 import logging

ModuleNotFoundError: No module named 'importlib_resources'

Default values of xtypes in expert plot

Code for expert_plot from documentation is not working. Error message: "ERROR:root:Invalid x_type argument None". One need to manually specify elevation_profile_x_type and pace_graph_x_type. I think it will be more user friendly to set "distance" as default value.

Negative long readings

I have a GPX file that uses negative longitudinal values for those west of the prime meridian. In matplotlib_plots there is the following line:

min_lat, min_lon = max(0, min_lat - offset), max(0, min_lon - offset)

that will force both the min and max longitudinal values to be zero if they are negative (and within offset of zero).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.