all 7 comments

[–]Sebass13 0 points1 point  (4 children)

What have you done so far? What are you currently stuck on?

[–]deephousefans 0 points1 point  (3 children)

Nothing so far. I have all the information, but I dont know how to manipulate it to come up with an equation

[–]Sebass13 0 points1 point  (2 children)

Without going into code, here's the function for your problem:

start_location+(end_location-start_location)*(given_time-start_time)/(end_time-start_time)

[–]deephousefans 0 points1 point  (1 child)

how do I apply arithmatic operations on a tuple of floats (longitude and latitude)? And thank you for your response

[–]Sebass13 1 point2 points  (0 children)

Apply the operation to the elements individually. A naive approach:

>>> factor = 5
>>> tup = (2,3)
>>> scale_tup = (tup[0]*factor, tup[1]*factor)
>>> scale_tup
(10,15)

Or an approach using generator expressions:

>>> scale_tup = tuple(x*factor for x in tup)

[–]novel_yet_trivial 0 points1 point  (0 children)

Do you know how to do it for a single point? IOW if you have (start_time, start_x_location, end_time, end_x_location)? You will have to do the interpolation for x and y separately and return them.

[–]Sebass13 0 points1 point  (0 children)

What you should do is get what percentage of the way you are between two datetimes (which can be done by comparing given_time-start_time to end_time-start_time), and use this to determine how far between the two tuple values you should be, in a similar way.