- Видео 3
- Просмотров 27 898
Siddhartha Paul
Индия
Добавлен 6 ноя 2022
How to Plot Directions in Google Maps using Python | Route Plot | GMAPS
Creating route and direction plots in Google Maps using python. Used route generated from Travelling Salesman Problem (TSP) as an example.
Просмотров: 11 406
Видео
How to Calculate Distance Matrix using Google Maps in Python | Python | Google Maps
Просмотров 12 тыс.Год назад
* Calculating point-to-point distance and travel time using google maps API in Python. * A demo for solving a Travelling Salesman Problem (TSP) with the distance matrix. Links: Google Maps Platform: mapsplatform.google.com Direction API Documentaton: developers.google.com/maps/documentation/directions/get-directions
Travelling Salesman Problem (TSP) in Python | OR-Tools | kepler.gl
Просмотров 4,1 тыс.2 года назад
This video shows how we can solve a Travelling Salesman Problem (TSP) in python using open-source Google OR-Tools. Also, how can we plot & visualize the route using kepler.gl? Links * OR-Tools: developers.google.com/optimization/routing/tsp * Kepler.gl: docs.kepler.gl/docs/keplergl-jupyter * GitHub Link: github.com/paulsiddhartha0/travelling_salesman_problem.git * Cities Lat Long Data Set: www....
🎉🎉good product 🎉🎉 need interface where we can select in from and to position
Hi there! Does this solution also take trafic into account or at least knows how long a route takes more than just a length bases calculation?
Hi Paul, currently I get stuck with this idea: I have 1 depot and 9 customer (and I also have a dynamic customer list that will occur in each iteration). So can I ask you about the way to arrange my data files for the problem? In your video, I see that you set the "from_node" and "to_node" columns, so I think it will be hard for me to follow this since when there is a dynamic customer, their lat and long will be insert into the data file and create a new distance matrix of all nodes. So I hope to receive your response soon. Thank you very much
Hi bro i have a probleem with my code can i contact you by whatsapp please? Thank you
...
cool
Suppose I need to deliver products to 20+ places based on their lat-longs from the depot, Is TSP going to help optimize the routes and determine how many vehicles do I need? Basically Can it optimize routes, vehicle numbers simultaneously?
Yes you can use a capacity vehicle routing formulation with large capacity. This would automatically optimize for distance and vehicle count (assuming homogeneous vehicle type).
So this is arc constraint problem?
how can i save coordinates of routes
you can use dictionaries with node id as key and coordinates as values.
Do we need to generate route_plan xcel on our own, what data should we include can you please share route_plan ?
No need to generate xcel file.. it's there in git hub link
Thanks for the video. When you are calculating distance matrix, does google charge you based on number of API calls or on the basis of number of origins X number of destinations?
Basically, each origin-destination pair is considered as one call. So its number of origins X number of destinations unless you prune efficiently.
Very useful. Thanks a lot!
Thanks. This tutorial has been super helpful. I keep getting the following index error when trying to iterate through the rows to get the distance and travel time: <ipython-input-14-82106501bbfa> in <cell line: 1>() 3 direction_result = gmaps_client.directions(row['from_lat_long'], row['to_lat_long'], 4 mode = "driving", avoid = "ferries", departure_time = start_time) ----> 5 df.loc[index, 'distance'] = direction_result[0]['legs'][0]['distance']['value'] 6 df.loc[index, 'travel_time'] = direction_result[0]['legs'][0]['duration']['value'] 7 df.loc[index, 'distance_text'] = direction_result[0]['legs'][0]['distance']['text'] IndexError: list index out of range Do you have any recommendations?
Hi, thank you for your videl. If I may ask, there are some option parameters in distance matrix api, such as we can set up trafifc_model as 'best_guess', 'pessimistic', 'optimistic'. can we set up these parameters?
yes, you can setup these parameters as follows: direction_result = gmaps_client.directions(source, destination , mode="driving", avoid="ferries", departure_time=now, transit_mode = 'bus', traffic_model='optimistic')
how can you display the distance travelled in the TSP solution?
you can use the following piece of code for r in range(len(route)-1): print('%s-->%s (%d)'%(route[r], route[r+1], distance_dict[route[r],route[r+1]]))
Can you share the code ??
Can you share the code ??
Hi Siddhartha ............I found this video really helpful for my Project...Kindly share the link of the python code
Hi, thanks your video, it is usefull to me could you share your source code?
hi. thank you for your explanation about the distance matrix calculation. that's so helpful for me to understand. if i may ask, how can u get thos latlong data? can we use the geocode in gmaps api? please kindly enlighten me. thank you!
Yes, you can use geocode in gmaps API. You can refer to ruclips.net/video/mXGyH8_FcMQ/видео.html In "source" and "destination", you can just enter the location names instead of the lat longs. Also, you can use gmaps "geocode" API to get the lat, longs. E.g. "geocode_result = gmaps.geocode("Kolkata") print(geocode_result[0]['geometry']['location'] ['lat'], geocode_result[0]['geometry']['location']['lng'])" Hope this helps.