2

I am developing an iOS app where I need to get the walking route distance between two locations.

I have used CoreLocation API

- (CLLocationDistance)distanceFromLocation:(const CLLocation *)location

As per the documentation This method measures the distance between the two locations by tracing a line between them that follows the curvature of the Earth.

The distance it gave was different from the the one which shown in the iOS map app (after converting to miles) as shown in the figure.

walking route distance

I want to get the walking route distance between two locations which we gets in the map app inside my app. is there any API to get this distance.

Could anyone please help me to achieve this.

4

1 回答 1

2

CoreLocation API 没有给出步行路线的距离,它只能给出直线“如乌鸦飞”的距离。您需要查询具有街道和人行道网络的网络服务以获取实际步行距离。CL 和 MapKit 不提供此服务。

您可以向 Apple Maps 应用程序发送请求以获取两点之间的步行路线,但结果不会返回给您的应用程序,而是呈现给用户。

于 2013-06-26T14:48:19.977 回答