0

I have used the google maps API to get directions to a spot with 3 different waypoints.

I have found a way to pass the directions as a JSON to the app and I know how to parse it by legs but my question is how do I invoke the map to follow these directions? It must follow the custom directions google sent as it uses their Traveling Salesman Algorithm and there are different waypoints that it must stop at.

Any ideas?

Here is a example of the JSON message that would be used

Any help would be appreciated.

Thanks

Community
  • 1
  • 1
Dfranc3373
  • 2,048
  • 4
  • 30
  • 44

1 Answers1

0

It looks like you just need to input your origin, destination, and waypoints into the directions render service and plot to the map.

Look at this link and scroll down to the waypoint portion.

https://developers.google.com/maps/documentation/javascript/directions#DirectionsRequests

This will show you an example of how to get directions from the directions service.

From looking at your file though if you don't have an actual account that you are paying for with google maps, you are going to hit the 8 waypoint maximum very quickly due to all of your waypoints (lats/longs).

Here is a post that describes how to get around that, but if you have an account it shouldn't be an issue.

Exceed 23 waypoint per request limit on Google Directions API (Business/Work level)

HTH

Community
  • 1
  • 1
Bill Blankenship
  • 3,316
  • 6
  • 43
  • 73
  • I have a business account and I have a way to get the directions, my question is how do I draw the lines for the directions of a MKMapView – Dfranc3373 May 15 '12 at 23:10
  • I didn't see a reference to MKMapView in your question until just now. If you are using google maps api you just create a polyline between points. So your question is now regarding how to draw lines in MKMapView? – Bill Blankenship May 16 '12 at 15:41