Shortest route between multiple points in mapkit f

2019-07-19 02:17发布

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

2条回答
淡お忘
2楼-- · 2019-07-19 02:56

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.

查看更多
唯我独甜
3楼-- · 2019-07-19 02:58

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/

查看更多
登录 后发表回答