Shortest route between multiple points in mapkit for iphone app

时光毁灭记忆、已成空白 提交于 2020-01-04 11:39:06

问题


In my application suppose user selects 4 cities to vist with S as starting city and D as destination city then is there any API or webservice for this .

Here the users visits the city one time only and the output should be the shortest path between A and D by covering all the cities. If somebody has any other idea it is also welcomed.

Thanks and Regards Mrugen


回答1:


Mapquest has recently really taken the lead in terms of navigation and geocoding APIs. FAR better than Google's offering, IMO. They're hosting OpenStreetMap data and an excellent (and wide open) interface to it. No access keys, no restrictions, just bang, DATA.

Here's the URL to their directions API. Short version is, provide two lat/lng points (which they also have an interface to look up from a street address or other landmark) and it'll give turn by turn directions.

http://open.mapquestapi.com/directions/




回答2:


firstly u should konw city"s latitude and longtitude and u use code

CLLocationCoordinate2D start = {43.759063, -79.236128};

NSString *urlString = [NSString stringWithFormat:@"http://maps.google.com/maps?daddr=%@,%@&saddr=%f,%f",mi.memberyLat,mi.memberLong,start.latitude  ,start.longitude];

[[UIApplication sharedApplication] openURL: [NSURL URLWithString: urlString]];

in this code mi.memberyLat means u pass city latitude mi.memberLong means u pass city long.



来源:https://stackoverflow.com/questions/5991312/shortest-route-between-multiple-points-in-mapkit-for-iphone-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!