Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get all cities info over a route between two geo points

I have an question that while using Google Direction Api we can get the list of data like city's name, its Lat & Lng etc but the data provided by Api is limited to some extend. It's not able to provide all cities coming with-in that particular route.

E.g. If we try to go for Chandigarh to Delhi, then the route has a fixed result but when we try to reverse that same search i.e. Delhi to Chandigarh, some of the cities coming in previous result get vanished in api's new result, moreover, we just have a limited amount of locations/cities in result while we need the route completely detailed.

Do any of you guys faced this issue before? Is there any other way to match such requirement?

Hope I am understandable.

Thanks.

like image 459
Karan Avatar asked Oct 21 '22 12:10

Karan


1 Answers

Use the below url:

https://maps.googleapis.com/maps/api/directions/json?origin="latvalue","longvalue"&destination="destnLat","destnLong"
&sensor=false&avoid=highways&mode=driving&alternatives=true

you have to set the alternatives value to true so it will result different routes available between the source and destination

like image 101
jyomin Avatar answered Oct 23 '22 11:10

jyomin