I am Developing an iOS Application. In that Application i am having 2 Fields From and To. I Entered Address using Google Auto Complete API.and also i am able to Getting the Latitude and Longitude of the 2 places and able to show markers on the GMSMapView
.
Now i Want to Draw Route Between these 2 Places. I found a solution when we use MKMapView
. But i was Unable to find the solution for GMSMapView
. please help me to Draw the route between these 2 points in GMSMapView
.
If possible please give me some important links for this.
Thanks.
I have made it with AlamoFire and SwiftyJson in xCode 8.3.3 and Swift 3.1. Put the drawing of the path in a function that needs two parameters only
a String origin example "48.7788,9.22222" and a String destination example "49.3212232,8.334151"
Make an URL request to Google Directions API and when you receive a JSON file go through all steps and decode the points objects.
Hi You can use "LRouteController", it is a best way to show road route between two points like :
Try it, I hope it will resolve your problem.
DirectionResponse from the Google Directions APIThe NSLogs are useful to see what you are working with.
I've written the following code which should do the trick for you: