问题
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