Android使用Location对象获取距离(Android getting the distance using a Location object)
我想拍摄一系列由GPS返回的坐标样本并计算它们之间的(直线)距离,这样我就可以通过Excel绘制距离图。 我看到
Location
类的方法distanceBetween
和distanceTo
,但我担心这些不会返回直线距离。有没有人知道这些方法返回的距离,或者是否有任何方法可以根据
Location
类返回的纬度/经度值计算直线距离?I’d like to take a series of samples of coordinates returned by GPS and calculate the (straight line) distance between them so I can graph the distances via Excel. I see the method
distanceBetween
anddistanceTo
of theLocation
class, but I’m concerned these don’t return the straight line distance.Does anyone know what distance is returned by these methods or if there are any ways to calculate straight line distance based on latitude/longitude values returned by the
Location
class?
原文:https://stackoverflow.com/questions/5315015