Google Mobility: Working with Google ODRD, LMFS and Cloud Fleet Routing APIs
How to use the Google Mobility suite of APIs to build ride share and delivery applications.
Google Mobility is the umbrella term for a group of advanced Google Maps Platform APIs and services designed for creating mobility solutions. In this series, I'll explain how you can use Mobility's most popular APIs to build your own logistics applications.
Part 1: Google Mobility: An introduction to Google ODRD, LMFS and Cloud Fleet Routing APIs (this article)
Part 2: Google ODRD: Routes Preferred computeRoutes API
Part 3: Google LMFS: Routes Preferred ComputeRouteMatrix API
Part 4: Google Cloud Fleet Routing: OptimizeTours API
Part 5: Google ODRD: Navigation SDK
Unlike Google Maps's standard pay as you go APIs, you need to sign up with a Google Maps Partner to access Google Mobility. This is because Google Mobility bills per completed trip, and the responsibility for making sure that the number of completed trips is in line with acceptable API usage belongs to the Partner. The cost for each completed trip varies, ranging from USD$0.10 to USD$0.15, depending on your industry, usage volume, and API mix. You need to be a bona fide delivery company or last mile logistics software provider to sign up with a Partner, so if you are just looking to play with the APIs for fun, you're out of luck.
Google's Mobility APIs are broadly grouped into three categories:
On Demand Ride and Deliveries (ODRD)
ODRD APIs are used to build on ride share and delivery applications where requests are created "on demand" i.e. in real time e.g. Uber (ride share) and Doordash (food delivery). For example, the SearchVehicles API helps you match a new booking to the nearest available driver while the Places Autocomplete API lets customers correctly specify their pickup and drop off locations.
Last Mile Fleet Solution (LMFS)
LMFS APIs are used in last mile delivery software that deal with deliveries scheduled ahead of time. For example, most courier companies plan routes the day before. Because each delivery has a specific place in a route, it's possible to let customers track the status of their deliveries and the ETA (Estimated Arrival Time) by monitoring the real time progress of the driver making the delivery. Google's Trip and Order Progress and Shipment Tracking APIs are perfect for this.
Cloud Fleet Routing
Cloud Fleet Routing is a standalone route and fleet optimization toolkit that competes with API-first route optimization providers such as Routific, LogisticsOS and GraphHopper as well as open source vehicle routing solvers like jsprit and OR Tools. Cloud Fleet Routing's OptimizeTours API finds the most cost effective (travel distance minimizing) way for a fleet of vehicles to complete all the jobs assigned to it. It helps logistics companies answer questions such as "How many vehicles do I need to serve all my customer deliveries tomorrow?" or "For each driver, in what order should I sequence his route?".
Initially, ODRD, LMFS and Cloud Fleet Routing were built and marketed as separate products each with their own engineering, product management and sales teams. Google Maps was responsible for ODRD and LMFS while Google Cloud handled Cloud Fleet Routing. As of mid-2023, all three products have been combined under the Google Mobility banner and customers (working through their respective Google Maps Partners) can pick and choose which APIs they want to use.
The best way to describe how Google APIs are used in fleet mobility solutions is to use the real world example of RouteBasic, a free route planner for small businesses that plan their own routes. RouteBasic (below) uses the Place Search API (1) to let drivers specify customer delivery locations and add them to a route, one at a time. Once a list of delivery addresses is compiled, RouteBasic calls the Cloud Fleet Routing API (2) to build the driver's route for the day and sequence his stops optimally. The route is shown on a Maps SDK base map (3) together with his stops. Each stop is numbered according to the order in which they are to be visited. Lastly, when a driver heads to a particular stop, he can use the [Navigate] button to start in-app turn by turn navigation powered by the Navigation SDK (4).
Google Mobility Pricing
Unlike the standard Google Maps APIs, which are billed on a pay-as-you-go basis for individual API usage, Google Mobility charges per completed trip. With each completed trip, you are given a specific number of Google Maps API calls. For instance, under the Mobility Activate package, you receive 50 Directions API calls, 20 Places API Autocomplete calls, 10 Route Optimization API calls, and more. For a full list of available API calls, please contact afian.anwar@hkmci.com.
While the cost per completed trip depends on the terms agreed upon with your Google Maps Partner, the types of APIs you can access are based on the Mobility Tier you are subscribed to.
Mobility Activate gives you access to all the standard Google Maps APIs plus the Navigation SDK.
Mobility Optimize includes all of the services in the Mobility Activate package, plus APIs for speed limits and single vehicle route optimization.
Mobility Accelerate includes all of the services in Mobility Optimize plus the APIs & SDKs needed to integrate with the stateful Fleet Engine service that receives, maintains, and provides information about vehicles, trips, and tasks.
What you'll learn in this course
By the end of this tutorial, you'll learn how to make calls and understand the strengths and limitations of four of the most important APIs in Google Mobility:
Routes Preferred returns driving directions, travel time (which includes real time traffic) and polylines for the fastest route between two points.
Compute Route Matrix returns travel times (including real time traffic) for up to 25 origin destination pairs.
Optimize Tours is a performant vehicle routing and pickup and delivery problem solver that uses real time traffic information to calculate optimal routes.
Navigation SDK is Google's in-app navigation product. It was previously restricted to large companies such as Uber and Go Jek that used it as part of their driver app.
👋 As always, if you have any questions or suggestions for me, please reach out or say hello on LinkedIn.