Note that there are some explanatory texts on larger screens.

plurals
  1. POIf I am here and heading towards there and I've covered this much ground, where am I?
    text
    copied!<p>I need help writing the following method:</p> <pre><code>def get_new_location(current_location, target_location, distance_travelled): ... ... return new_location </code></pre> <p>where all locations are (lat,long)</p> <p>I realize that there are different models for the earth (WGS-84, GRS-80, ...) which take into account the fact that the earth is an ellipsoid. For my purposes, this level of precision is not necessary, assuming a perfect sphere is good enough.</p> <p><strong>UPDATE</strong></p> <p>I'm fine tuning my question taking into account some of the responses.</p> <p><code>benjismith</code> argues that my question cannot be answered because there is more than one shortest path between points on the globe. He has a lot of backing in the form of votes, so I guess there's something I don't understand, because I disagree.</p> <blockquote> <p>The midpoint between any two locations on a sphere is a circular arc.</p> </blockquote> <p>I concede that this is true when two points are at complete opposites. By this I mean that both points, while remaining on the surface of the sphere, could not be any further away from each other. In this case there are infinite number of equidistant paths joining both points. This, however, is an edge case, not the rule. In all other cases, the vast majority of cases, there is a single shortest path.</p> <p>To illustrate: if you were to hold a string which passed through two points, and pulled it tight, would there not be only one possible path on which the string would settle (except the edge case already discussed)?</p> <p>Now, prior to asking the question, obtaining the distance between two points and the heading was not a problem.</p> <p>I guess what I should have asked is if the following is valid:</p> <pre><code>def get_new_location(current_location, target_location, percent_traveled): new_location.lon = (1-percent_traveled)*current_location.lon+percent_traveled*target_location.lon new_location.lat = (1-percent_traveled)*current_location.lat+percent_traveled*target_location.lat return new_location </code></pre> <p>If I were to follow this path, would I be following the great-circle, the rhumb line, ... or would I be completely off? (I know these terms now because of Drew Hall's answer.)</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