Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rogue run finder #1

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add rogue run finder #1

wants to merge 7 commits into from

Conversation

dwj300
Copy link
Collaborator

@dwj300 dwj300 commented Jan 29, 2020

Also add virtualennv / .DS_Store to the .gitignore

@@ -216,7 +217,7 @@ def add_shared_args(parser):
coords = np.array([[np.average(d["lats"][0]), np.average(d["lons"][0])] for d in data])

if args.type == "cluster":
cluster = DBSCAN(eps=args.radius, min_samples=10)
cluster = DBSCAN(eps=args.radius, min_samples=args.min_cluster_size)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@@ -156,6 +155,8 @@ def add_shared_args(parser):
help="if defined only include this activity type")
parser.add_argument("--gpx-dir", default="strava",
help="directory with gpx files")
parser.add_argument("--use-osm", default=False, action="store_true",
help="overlay heatmap on top of OpenStreetMap")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@tomstitt
Copy link
Owner

tomstitt commented Jan 31, 2020

I think it would be better to split segments with large jumps into multiple segments, that way they don't need to be skipped. In that case a track with 1 segment that includes a skip:

<trk>
  <name>Lunch Ride</name>
  <type>1</type>
  <trkseg>
   <trkpt lat="37.8350560" lon="-122.1949540">
    <ele>328.0</ele>
    <time>2017-05-21T19:16:51Z</time>
   </trkpt>
   <trkpt lat="37.8350850" lon="-122.1948800">
    <ele>327.4</ele>
    <time>2017-05-21T19:16:52Z</time>
   </trkpt>
   <trkpt lat="37.8350570" lon="-122.1948800">
    <ele>327.5</ele>
    <time>2017-05-21T19:16:55Z</time>
   </trkpt>
   <!--Let's say the skip occurs here-->
   <trkpt lat="37.8350320" lon="-122.1949230">
    <ele>327.7</ele>
    <time>2017-05-21T19:16:57Z</time>
   </trkpt>
   <trkpt lat="37.8350100" lon="-122.1949850">
    <ele>327.8</ele>
    <time>2017-05-21T19:16:59Z</time>
   </trkpt>
   <trkpt lat="37.8350050" lon="-122.1950210">
    <ele>327.9</ele>
    <time>2017-05-21T19:17:00Z</time>
   </trkpt>
  </trkseg>
</trk>

Becomes:

<trk>
  <name>Lunch Ride</name>
  <type>1</type>
  <trkseg>
   <trkpt lat="37.8350560" lon="-122.1949540">
    <ele>328.0</ele>
    <time>2017-05-21T19:16:51Z</time>
   </trkpt>
   <trkpt lat="37.8350850" lon="-122.1948800">
    <ele>327.4</ele>
    <time>2017-05-21T19:16:52Z</time>
   </trkpt>
   <trkpt lat="37.8350570" lon="-122.1948800">
    <ele>327.5</ele>
    <time>2017-05-21T19:16:55Z</time>
   </trkpt>
  </trkseg>
  <!--End last segment, start new one-->
  <trkseg>
   <trkpt lat="37.8350320" lon="-122.1949230">
    <ele>327.7</ele>
    <time>2017-05-21T19:16:57Z</time>
   </trkpt>
   <trkpt lat="37.8350100" lon="-122.1949850">
    <ele>327.8</ele>
    <time>2017-05-21T19:16:59Z</time>
   </trkpt>
   <trkpt lat="37.8350050" lon="-122.1950210">
    <ele>327.9</ele>
    <time>2017-05-21T19:17:00Z</time>
   </trkpt>
  </trkseg>
</trk>

edit: Yes, gpxpy supports updating the gpx objects then saving them back as xml:

with open(file, "r") as f:
    gpx = gpxpy.parse(f)
track = gpx.tracks[0]
segment = track.segments[0]
if has_jump(segment):
    track.segments = ...
with open(file, "w") as f:
    file.write(gpx.to_xml())

There's an assumption in load_gpx that there is only one segment but that's easy to change

@dwj300
Copy link
Collaborator Author

dwj300 commented Jan 31, 2020

good idea! ill make those changes today

@tomstitt
Copy link
Owner

tomstitt commented Feb 5, 2020

Can you rename rogue to something more descriptive (split, remove_jumps, etc) and add a line to the readme? Also, what was your motivation for moving the .py files out of the top level? I don't think of this as something ppl will pip (since it's just some scripts) so I'm not sure it's needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants