Note that there are some explanatory texts on larger screens.

plurals
  1. POHow toget a list of "fastest miles" from a set of GPS Points
    text
    copied!<p>I'm trying to solve a weird problem. Maybe you guys know of some algorithm that takes care of this.</p> <p>I have data for a cargo freight truck and want to extract some data. Suppose I've got a list of sorted points that I get from the GPS. That's the route for that truck:</p> <pre><code>[ { "lng": "-111.5373066", "lat": "40.7231711", "time": "1970-01-01T00:00:04Z", "elev": "1942.1789265256325" }, { "lng": "-111.5372056", "lat": "40.7228762", "time": "1970-01-01T00:00:07Z", "elev": "1942.109892409177" } ] </code></pre> <p>Now, what I want to get is a list of the "fastest miles". I'll do an example:</p> <p>Given the points:</p> <pre><code>A, B, C, D, E, F </code></pre> <p>the distance from point A to point B is 1 mile, and the cargo took 10:32 minutes. From point B to point D i've got other mile, and the cargo took 10 minutes, etc. So, i need a list sorted by time. Similar to:</p> <pre><code>B -&gt; D: 10 A -&gt; B: 10:32 D -&gt; F: 11:02 </code></pre> <p>Do you know any efficient algorithm that let me calculate that?</p> <p>Thank you all.</p> <p>PS: I'm using Python.</p> <p><strong>EDIT:</strong></p> <p>I've got the distance. I know how to calculate it and there are plenty of posts to do that. What I need is an algorithm to tokenize by mile and get speed from that. Having a distance function is not helpful enough:</p> <pre><code>results = {} for point in points: aux_points = points.takeWhile(point&gt;n) #This doesn't exist, just trying to be simple for aux_point in aux_points: d = distance(point, aux_point) if d == 1_MILE: time_elapsed = time(point, aux_point) results[time_elapsed] = (point, aux_point) </code></pre> <p>I'm still doing some pretty inefficient calculations.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload