Code Monkey home page Code Monkey logo

Comments (4)

eumiro avatar eumiro commented on May 26, 2024

Thank you, I have actually originally started with gpxpy and utm (I'm already using utm to convert back to latlon to plot in ipyleaflet), but it was comparatively much slower (speaking about 60k+ points, which represents over 900km of tracks) when loading all raw GPX files each time:

def read_segments():
    for path in sorted(Path(".").glob("gpx/*.gpx")):
        gpx = gpxpy.parse(path.read_text())
        for track in gpx.tracks:
            for segment in track.segments:
                if len(segment.points) < 5:
                    continue
                yield [
                    (point.time_difference(segment.points[0]),
                     utm.from_latlon(point.latitude, point.longitude, 32, "U")[:2])
                    for point in segment.points
                ]
segments = list(read_segments())

UTM system is perfect for local geometry and distances, but maybe with GeoPandas the expensive conversion could be skipped.

The performance problem is also the conversion of ALL points, which could be solved by some simplifying methods of gpxpy.

Or some sort of database/cache for all converted points. And we're back at CSVs, which offer the user a stable and reviewable step in data processing.

from pygohome.

philshem avatar philshem commented on May 26, 2024

Another option is to run gpsbabel in the Jupyter notebook with Unix commands (!)

https://intro.syzygy.ca/unix-tricks/#unix-and-magic-in-a-notebook

(Would have to run with ‘wget’ or ‘git clone’ to get local ‘gpsbabel’ binary.)

from pygohome.

eumiro avatar eumiro commented on May 26, 2024

utm can do NumPy arrays, it is just too shy about it. That's why I added it to its docs: Turbo87/utm#50
Converting 1M points in a loop takes 90 seconds, a 1M numpy array needs 0.26s. Now it's an option again.

from pygohome.

eumiro avatar eumiro commented on May 26, 2024

gpxpy and utm used to load GPX files in 1a30a69
Thanks @philshem

from pygohome.

Related Issues (6)

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.