0

I am creating IOS Application map based application in my app I like to show the route/path between source and destination and also I have done that but I will show only one route/path. I like to show all the possible path between the source and the destination like google map. To illustrate my idea I have added the screenshot I like to show path like this. Is there is any sample for this?enter image description here

Thanks in advance

btmanikandan
  • 1,923
  • 2
  • 25
  • 45

1 Answers1

1

Follow these simple steps :

  1. Get Two Input locations.
  2. Use the method -geocodeAddressString: completionHandler: of Geo Coder class (from Core Location Framework) for getting the coordinates for the given location string.
  3. Use MkPointAnnotation object for creating annotation on the locations in map.
  4. Send request to the google API for getting the Direction between two locations.
  5. As of the google API Response (Available in both JSON & XML) You would have overview_polyline object, which has the array of location coordinates. But they were encoded, you have to use the correct decoding module to get the latitude and longitude. With the decoded location coordinates you can create the poly lines using MKPolyline instance method. MKPolyline *polyLine = [MKPolyline polylineWithCoordinates:coordinates count:[overlayPoints count]]; [mapView addOverlay:polyLine];
  6. Now the polyline have been drawn over the map still it will not be visible as the final go we have to override the -viewForOverlay method for displaying the poly line view.
  7. If you still have any confusions then you can always check some Tutorials.
Bhavin
  • 27,155
  • 11
  • 55
  • 94