Ground Transportation Logistics App

A route optimization problem

For the ground transportation logistics during the Lima2019 Pan-american Games, our team needed an application to handle the multiple and random transportation requests in an efficient way.

We used to store in our database our team members' most common destinations. In this way we could schedule efficient round trips and inform the team of the available vans.


During the ceremonies our team growth became difficult to track and we couldn't rely on our database to provide an efficient nor effective service.

We needed a dynamic solution that could compute the best trip on the fly using the database destination and custom ones.

Just scanning our team members' badges we can quickly extract their destination from the database.

What about custom destinations?

First we needed to be sure the they really existed. Our application queries Google Maps API autocomplete service in order to be sure the route computer always takes as input existing destinations.

# We will use Google Maps Place API to autocomplete the wanted destination and be sure it really exists. # Plus in order to get more accurate results we will use a circular location bias centered at lat&lng with a n radius meters. https://maps.googleapis.com/maps/api/place/queryautocomplete/json?
key=ACr4zyL0ongG___0__0gl_3M4p5Ap1K3y1&
input=The+Stop+Address&
location=latitude,longitude&radius=meters

Once we collected all the waypoints we need to compute the best route in order to minimize the round trip cost.

People in the stadium are always in a hurry. Hence we have to be able to compute the best route in a very short time. Using the Google Maps implementation for the traveling salesman problem we can give our user an answer in less than a second!

# We will send the waypoints in random order to the Directions API with the flag optimize:true # It will return the best order considering the origin and destination. https://maps.googleapis.com/maps/api/directions/json?
origin=The+origin+address&destination=The+destination+address&
waypoints=optimize:true|The+waypoints+addresses|Separated+by+a+pipe|Symbol&
key=ACr4zyL0ongG___0__0gl_3M4p5Ap1K3y1"

Now that Google API returns us the optimized waypoints order we can easily build a Google Maps URL to send to our drivers and start the navigation directly on their phones!

# We will add the flags travelmode=driving and dir_action=navigate for the URL to be used in the Google Maps application and automatically start the navigation. https://www.google.com/maps/dir/?api=1&
origin=The+origin+address&destination=The+destination+address&
travelmode=driving&dir_action=navigate&
waypoints=The+waypoints+addresses|Separated+by+a+pipe|Symbol