Optimize delivery routes with Google Maps
A Delivery Trip lists the stops that a driver makes. With a Google Maps API key, ERPNext can calculate the arrival time at each stop and reorder the stops into an optimized route.
Prerequisites
- An API Key in Google Settings, with the Directions API enabled in Google Cloud.
- A Driver on the Delivery Trip, and an address for the driver (Driver Address). Google Maps uses it as the start and end point.
- An address on each delivery stop.
Calculate arrival times and optimize the route
- Open the Delivery Trip.
- Select Optimize Route to reorder the stops into the order that Google Maps suggests.
- Select Calculate Estimated Arrival Times to fill in the estimated arrival time of each stop. ERPNext uses the Departure Time of the trip as the start.

Troubleshooting
| Message | Cause | Fix |
|---|---|---|
| Enter API key in Google Settings. | Google Settings has no API key | Add the API key, see Set up Google Settings |
| Cannot Optimize Route as Driver Address is Missing. | The driver has no address | Set the Driver Address on the Delivery Trip |
| Cannot Calculate Arrival Time as Driver Address is Missing. | The driver has no address | Set the Driver Address on the Delivery Trip |