在iPhone中计算行驶距离 [英] Calculating driving distance in iPhone

查看:179
本文介绍了在iPhone中计算行驶距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到2个位置之间的行驶距离.我不需要在地图上显示方向,只需计算距离,我就需要在应用程序中使用该距离.

I need to find the driving distance between 2 locations. I do not need to display the directions in a map, just need to calculate the distance, which I need to use in my application.

MapKit允许吗?有没有可以使用的替代方法?

Does MapKit allow this? Is there an alternative that can be used?

我能够使用CloudMade进行地理编码,但是似乎没有选择来获得行驶距离的方法.

I am able to get forward geo-coding using CloudMade, but there doesn't seem to be an option to obtain driving distance.

感谢任何帮助.

推荐答案

CloudMade还提供了行车路线.如果您仅对距离感兴趣,只需忽略说明.

CloudMade also offers driving directions. If you are only interested in the distance, simply ignore the instructions.

API调用看起来像这样:

An API-Call looks like this:

并且JSON包含

....
route_summary: {
total_distance: Distance in meters,...

来源

这篇关于在iPhone中计算行驶距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆