4 ms·
> without accounting for the curvature of the Earth) is 768 and a quarter After accounting for the curvature of the Earth, the distance between (53.92085665, 1
by sobriquet9 4y ago
> without accounting for the curvature of the Earth) is 768 and a quarter
After accounting for the curvature of the Earth, the distance between (53.92085665, 14.2861684) and (49.0080789, 22.88022362) is 806 km, and the line is very different from what's shown in the article.
- bunabhucan 4y agoDo you think the curvature is why it's wrong or there's just a mistake/bug that the code skipped that point/pair? Distance is ~5% off but the latitude difference between the two SE candidates are only ~1/70th of a quarter circle.
- hakuseki 4y agoA small latitude difference does not imply that you can ignore curvature. I am just guessing, but perhaps your intuition is that the shortest path should lie along a line of latitude. An easy-to-see counterexample would be two points close to the north pole, but with 180 degrees of longitude separating them. In this case the shortest path actually goes through the north pole, rather than around it. You can also generalize this say that within the northern hemisphere, the shortest path between two points will curve (when viewed on a flat map) towards the north pole.
- sobriquet9 4y agocos(54 deg)/cos(49 deg) ~ 0.588/0.656 ~ 0.9, so a longitude degree in the north of the country is about 10% shorter than in the south.
- piotrjaw 4y agoIndeed, I added a couple of paragraphs in the end explaining the difference and the actual results. As a side note, I actually got slightly different numbers, but maybe that's because of the lower quality of data that I used.
- bunabhucan 4y agoCan you tell us what the both line solutions measure to using the first approach and the second approach? I'm curious about the effect of the curvature on the calculation. Thanks!
- piotrjaw 4y agoSure! It's pretty straightforward actually. The first approach (which is a simplification) uses the usual way to calculate a distance between two points on a FLAT plane, which using is the Pythagorean Theorem. So d = √((y1 - y2)^2 + (x1 - x2)^2). The second approach uses the haversine formula: https://en.wikipedia.org/wiki/Haversine_formula https://en.wikipedia.org/wiki/Haversine_formula which takes the curvature of the Earth into account, and also the fact that one degree in longitude is a different distance depending on the latitude.
- bunabhucan 4y agoSorry, I was asking for the numeric answers, I'm genuinely curious about the distance values of the two pairs of numbers using the two formula.