问题描述
我一直在使用 Moveable-Type 网站来帮助我进行一些地理坐标计算,它非常有用,但是,我在计算两个坐标之间的中点时遇到了错误.我的结果接近预期,但还不够接近:
I have been using the Moveable-Type website to aid me in some Geocoordinate calcuations and it's been very useful, however, I have a bug in my calculation of the mid-point between two coordinates. My result is close to the expected, but not close enough:
预期结果(取自活字计算器)= 47°38′40″N, 122°08′26″W = {47.644444, -122.140556}
我的结果:{49.6054801645915, -122.14052959995759}
expected result (taken from the movable type calculator) = 47°38′40″N, 122°08′26″W = {47.644444, -122.140556}
my result: {49.6054801645915, -122.14052959995759}
这是我的代码:
我有几个私有方法可以在度数和弧度之间进行转换并返回.例如
I've got a couple of private methods to do the conversion between Degrees and Radians and back. E.g.
我无法弄清楚为什么我的结果与 Lat 值相差几度.有什么想法吗?
I can't work out why my results are off by a couple of degrees on the Lat value. Any ideas?
谢谢
推荐答案
你把括号放错了.我在代码中标记了这个地方.
You placed some parentheses wrong. I marked the place in the code.
这篇关于两个坐标之间的地理中点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!