扑来 - 计算使用地理媒介和Google API驱动的里程
我使用的是Google Directions API,最初是为了从/到方向获取详细信息, ie 从丹佛到芝加哥。
我需要做的是在开车时获得实际道路里程。我正在成功地通过地理定位器从插件中流坐标,但是,当我获得两个GPS点之间的距离时,这是距离,而不是道路里程。如果我接受足够的这些小读数并加起来距离,这应该有些准确。
这是最好的方法吗?
我也可以继续致电Google API,但是在与大量用户的长途旅行中,这变得非常昂贵。
I am using the Google Directions API, initially to get the detailed from/to directions, i.e. from let's say Denver to Chicago.
What I need to do is get actual road mileage as they are driving. I am successfully streaming the coordinates from the plugin by geolocator, however, when I get distance between two GPS points it's the distance, not road mileage. This should be somewhat accurate if I take enough of these little readings and add up the distance.
Is this the best way?
I could also keep calling Google API, but that gets very expensive on a long trip with lots of users.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
API在路由的
leg
s中提供距离。循环通过它们,将总距离加起来为米。The API provides the distance in the route's
Leg
s. Loop through them to add up the total distance in meters.