Giter Club home page Giter Club logo

tracklib's Issues

Time Observation Read Format when reading GPX

Hi,

I'd like to begin by thanking you for this very powerful and ambitious library I've had the pleasure of discovering recently.

However, in my usage of the library, I've encountered a problem when importing some GPX files that were generated by a fairly high frequency GPS logger that has a sampling frequency of 4 [Hz].

Below is an excerpt of a sample .gpx

<trkseg> <trkpt lat="47.7252015" lon="-3.3494651"> <time>2023-10-15T06:33:22.500000Z</time> <speed>0.2</speed> </trkpt> <trkpt lat="47.725207" lon="-3.3494624"> <time>2023-10-15T06:33:22.750000Z</time> <speed>0.1</speed> </trkpt> <trkpt lat="47.7252121" lon="-3.3494586"> <time>2023-10-15T06:33:23Z</time> <speed>0.1</speed> </trkpt> <trkpt lat="47.7252154" lon="-3.3494555"> <time>2023-10-15T06:33:23.250000Z</time> <speed>0.1</speed> </trkpt> <\trkseg>

In order to import this data I've tried setting the time observation read format, with the following command :

trk.ObsTime.setReadFormat("4Y-2M-2DT2h:2m:2s.2zZ")

However, because of the following lines in the readFromGpx() function, the track I load doesn't contain the milli-seconds part of the observation times.

format_old = ObsTime.getReadFormat()
ObsTime.setReadFormat("4Y-2M-2D 2h:2m:2s")

This is problematic for the workflow I intend to to apply to the track, where for instance I try to compute the speed, which becomes "nan" when two sucessive observations have the same timestamp.

What I would have expected is that trk.ObsTime.setReadFormat would allow to load the data from this format, but the code doesn't allow it.

One fix would be to completely bypass the aformentioned lines (as well as

# pourquoi ?
# --> pour remettre le format comme il etait avant la lecture :)
ObsTime.setReadFormat(format_old)
)?

Another would be to let the readFormat be an optional user supplied argument to readFromGpx().

I've never contributed to a public github repository before, so I don't really know the workflow, but if you are interested I can try to contribute a commit that could implement one of these solutions?

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.