GMPRO: Google Maps Platform Route Optimization API
Everything you wanted to know about GMPRO but were afraid to ask. An introduction to the new Google Maps route optimization API.
GMPRO, or the Google Maps Platform Route Optimization API, is Google's latest take on tackling the vehicle routing problem. It helps you plan cost-effective routes for multiple vehicles in a fleet by sending over a JSON payload to the API and receiving a route solution in return.
This optimized route solution reduces driving time and saves fuel - something that is critical for any last mile delivery, courier, or ride share company. In this series of blog posts, I'll explain what GMPRO is, how it works, how to use it in your business, and how much it costs.
Part 1: GMPRO: Google Maps Platform route optimization API (this article)
Part 2: GMPRO TSP solver: Google Maps with more than 25 waypoints
Part 3: Google Maps route optimization: multi vehicle
Part 4: GMPRO fleet routing app - free route planner for multiple stops
Part 5: GMPRO docs: Fixed vehicle costs
Part 6: GMPRO docs: Territory optimization and route planning
Part 7: GMPRO docs: Solving the VRP with route clustering and soft constraints
Part 8: GMPRO docs: Driver load balancing with soft constraints
GMPRO replaces another Google route optimization API, Cloud Fleet Routing (scheduled to be deprecated Q2 2025), and is a huge step up from the Google Maps Directions API, which only lets you optimize up to 25 stops for a single vehicle. GMPRO can optimize routes for an entire fleet.
Why did Google launch GMPRO?
When was the last time you had something delivered to you? If you are reading this blog from somewhere in North America, I'm willing to bet that it was last week. It could have been a package from Amazon, groceries from Postmates or dinner from Uber Eats. In fact, the global e-commerce market was 14.1 trillion USD in 2022 and is projected to grow to 57.2 trillion by 2032. 21% of this market is from online purchases (up from 17% in 2020).
Each time someone buys a physical item online, it needs to be delivered. Goods must be packaged, stored in a warehouse, scheduled for delivery, and assigned to a driver who needs to find the recipient's home and make the delivery safely and on time. This scheduling and assignment process requires route optimization, which Google has identified as a significant market opportunity. Parking GMPRO under the Google Maps product family makes perfect sense - Google Maps already owns the building blocks needed for it, namely the Distance Matrix, Geocoding, and Routes APIs. Any future improvements e.g. truck routing rolled out on the Google Maps Platform can be added directly to GMPRO.
More importantly, Google can offer two must have features that other route optimization providers simply can't do cost effectively - real time traffic and very fast compute, all running on the same infrastructure that runs Google Maps.
Benefits of Route Optimization
There are three main ways businesses benefit from route optimization services like GMPRO:
- Happier customers. With route optimization, logistics companies can not only do more deliveries in a day, they can also provide customers with accurate ETAs and time windows for their delivery. This combination of speed and predictability is big selling point for any delivery company trying to exceed customer’s growing demand and expectations
- Happier drivers. Meeting drivers’ needs and expectations are also important to retain them. With proper calibration, Google's route optimization API can preferentially assign drivers to neighborhoods they are already familiar with, thereby reducing the amount of stress delivery drivers face when going somewhere new.
- Reduced costs. With inflation and gas prices at all time highs, it's become even more important to look for ways to reduce operational costs. Route optimization APIs such as GMPRO help by automatically selecting the most cost-effective route for each vehicle, leading to lower fuel consumption.
Who can benefit from GMPRO?
GMPRO is ideal for two kinds of companies - last mile delivery providers and ride share companies.
Last Mile Delivery Providers
Last-mile delivery providers are companies that take goods from a central warehouse and deliver them directly to your doorstep. They handle deliveries for companies like Amazon and IKEA. Typically, they plan their routes a day in advance, aiming to deliver as many packages as possible with the available number of drivers.
Ride Share Companies
Ride share companies are the Uber and Lyfts of the world. They operate a network of driver contractors who use their platform to pick up and drop off passengers. Here, GMPRO would be used as part of a ride share dispatch algorithm to assign drivers to passengers on demand, as and when trip booking requests are received.
More generally, any "fleet operator" (companies that operate a fleet of vehicles and drivers) can use GMPRO to improve operational efficiency e.g. field services companies (with technicians), medical providers (with doctors or nurses visiting multiple patients in a day), insurance companies (claim adjusters visiting customers) etc.
How do you use GMPRO?
GMPRO, like all products in the Google Maps Platform, is accessed through an API. It's designed for developers to use in building applications that require route optimization as part of their workflow. There are three basic elements of a GMPRO API call - a list of shipments
, a list of available vehicles
, and the model
, where settings and constraints are configured.
When combined and sent to GMPRO, the API returns a route solution (routes
), the optimal assignment of drivers to shipments and the sequence each driver should follow to visit the stops on their route.
A typical GMPRO API call looks something like this:
curl -X POST 'https://routeoptimization.googleapis.com/v1/projects/{project_name}:optimizeTours' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
--data-binary @- << EOM
{
"model": {
"shipments": [
{
"pickups": [
{
"arrivalLocation": {
"latitude": 49.2474624,
"longitude": -123.1532338
}
}
],
"deliveries": [
{
"arrivalLocation": {
"latitude": 49.227107,
"longitude": -123.1163085
}
}
]
}
],
"vehicles": [
{
"startLocation": {
"latitude": 49.2553636,
"longitude": -123.0873365
},
"endLocation": {
"latitude": 49.2201308,
"longitude": -123.1085687
}
}
],
"globalStartTime": "2023-01-13T16:00:00-08:00",
"globalEndTime": "2023-01-14T16:00:00-08:00"
},
"populatePolylines": true
}
EOM
and the corresponding route solution like this:
{
"routes": [
{
"vehicleStartTime": "2023-01-14T00:00:00Z",
"vehicleEndTime": "2023-01-14T00:25:21Z",
"visits": [
{
"isPickup": true,
"startTime": "2023-01-14T00:11:46Z",
"detour": "0s"
},
{
"startTime": "2023-01-14T00:20:56Z",
"detour": "0s"
}
],
"transitions": [
{
"travelDuration": "706s",
"travelDistanceMeters": 6063,
"waitDuration": "0s",
"totalDuration": "706s",
"startTime": "2023-01-14T00:00:00Z"
},
{
"travelDuration": "550s",
"travelDistanceMeters": 5105,
"waitDuration": "0s",
"totalDuration": "550s",
"startTime": "2023-01-14T00:11:46Z"
},
{
"travelDuration": "265s",
"travelDistanceMeters": 1852,
"waitDuration": "0s",
"totalDuration": "265s",
"startTime": "2023-01-14T00:20:56Z"
}
],
"routePolyline": {
"points": "_eskH`pgnVU?G~D?p@ApAAlC?ZZKb@?pAA`@@x@@xBDr@?d@@B?r@@N?P?jBBjA@rDDd@@b@@jB@b@@hB@d@@^?f@@\\??h@?`@?v@AbA?z@?^?`@AlAFf@AzEAv@?dA?fB?XAjCAdCAhC?pA?h@AlBAbB?@At@?b@E^A\\AxA?^?hA?TAZ?TAx@?b@AdCApBAtDDh@Ab@AbDAvBEfI?TAnCA`BCbBAxEIfB?d@?pAApA?bBCvB?bA?x@CzAAlA?`@AnD?h@AlA?R?XCpBAhC?ZATAlB?@AjB?HAl@?f@AhB?NClE?N?L?FAF?RA~B?d@?N?v@AnBEbE?@EnGC`CEpDAtA?F?t@C|A?`@?rCA~B?f@?RCxA?^G|KAlB?v@?t@C|E?b@AlBAt@AdDAfCA|BAlD?`@CpCAt@?b@EzEAbDA`CAzCAzCC`EAfA?xA?hBA\\AxE?BAt@?N?N?BA\\A\\?L?LCVAXADI`AId@ADAJIZEPAFK`@I\\M^O`@A@e@fAA@e@`AIPWf@o@pAg@jAGLABIRIRITITGTI^IZIj@CR?FARN@R?pABn@Bb@@b@@V@R@fAB^@xA@|@@f@@f@@R?r@?rBBZKD?`ABt@?P@~AB@?H?X?xABxA@R@n@Bl@@X@H?pA@n@Bp@@d@@bABvA@|ABBqE?_@?_C@eA@gB@i@?k@BeB?O?M@g@?WBeD@cD@k@?K?_@?U?U?C?i@@gB?qC@gCBqC@wB?w@@gA@sA?YDqK?KByD`EB|DDzDD~DFxBB|@DhDDtB@z@@tA@h@Dd@Bb@@N?l@@|@Bb@?pBChB@P@X?X?bAB^?V@Z?vA@n@@N@T?xABT?f@@J?`BBrAB~A?pA@rCDb@?FyFDgB@iABo@LwMD_D?EJiIBgB@c@BmB@w@@u@@{@ByB@w@Fc@?O@{@@m@BsA?g@BkB?Q@sABwAI]D_DBuBDkCDqDByABkA@{@BkCBoBBeA?g@@c@@g@?[@i@DaED_CDe@@e@Bw@@q@BmABgA@[B]UAkACI?q@Aa@AO?A?O?e@?aBCoACkBA@u@@oB?ED_DD}CDwCzAAxA?zAExAExACz@?XAFuE@G?AFuD?Q?S?K?]B_A@{@ByADuD@W?y@BkC?SBaC?Q@_CZ?z@?H?nABN?bA@N@H?jABT?hA@J@xA@fDDL?jDD?@?@?@?@@??@@??@@??@@?@?@??A@?@??A?A@??A?A@??A?A?AdDF"
},
"metrics": {
"performedShipmentCount": 1,
"travelDuration": "1521s",
"waitDuration": "0s",
"delayDuration": "0s",
"breakDuration": "0s",
"visitDuration": "0s",
"totalDuration": "1521s",
"travelDistanceMeters": 13020
}
}
],
"metrics": {
"aggregatedRouteMetrics": {
"performedShipmentCount": 1,
"travelDuration": "1521s",
"waitDuration": "0s",
"delayDuration": "0s",
"breakDuration": "0s",
"visitDuration": "0s",
"totalDuration": "1521s",
"travelDistanceMeters": 13020
},
"usedVehicleCount": 1,
"earliestVehicleStartTime": "2023-01-14T00:00:00Z",
"latestVehicleEndTime": "2023-01-14T00:25:21Z"
}
}
When uploaded to the GMPRO Fleet Routing App, here's what the route solution looks like on a map:
How do I get access to GMPRO?
GMPRO is in Unrestricted General Access (Unrestricted-GA), which means that anyone with a Google Cloud account can use the API. Unlike Google Mobility, you do not need to work with a Google Maps partner to get access.
How much does GMPRO cost?
Pricing starts at $10 USD per 1,000 visits for single vehicle routing and $30 USD per 1,000 visits for multi vehicle routing (official pricing page for Google Maps Platform). Reach out to a Google Maps Partner for volume pricing and discounts.
What you'll learn in this tutorial series
By the end of this series of blog posts, you'll master the basics of GMPRO. Specifically, you'll learn how to:
- Optimize routes for a single vehicle,
- Use GMPRO for fleet routing optimization on multiple vehicles,
- Visualize routes on the Fleet Routing App and,
- Compare pricing, features and performance for GMPRO and several well known competitors.
👋 As always, if you have any questions or suggestions for me, please reach out or say hello on LinkedIn.
Next: Part 2: GMPRO TSP solver: Google Maps with more than 25 waypoints