How Grocery Delivery Companies Optimize Route Operations With Dynamic Geofencing

8 mins Read

June 7, 2022

Ultra-fast grocery delivery services are exploding and rapidly evolving at the moment. But quite a few have already folded or are on their way to doing so. Naysayers have blamed this on the ‘unprofitable delivery’ business model.

But it is a viable business model if companies focus on optimizing delivery operations. is working with several grocery startups that have realized that optimization and consolidation of deliveries are imperative to the sustainable growth of their service. Getting order assignment, batching and dispatch right is crucial to making ultra-fast grocery delivery a profitable business. One way we help them to do this is via dynamic geofencing paired with our mapping solutions.

If your drivers are making just one stop per hour, then the instant-delivery business model  won’t be feasible. Similarly, if your drivers are forced to make twenty stops in an hour, that won’t work either. Dynamic geofencing can help optimize the number of stops and deliveries made per hour.

Yvan Montalieu,’s Head of Solutions Engineering, EMEA and Asia, recently hosted an insightful webinar, ‘How do dynamic geofences help businesses simplify logistics operations?’. He talked about multiple use cases and illustrated real-life examples to explain why and how they can help hyperlocal businesses.

In this post, we’ll solely focus on the grocery delivery use case and explore how dynamic geofences can impact its operational efficiency.

To see how this can be applied to ride-hailing use cases and the demos of our powerful map tools, watch the webinar here.

The inefficiency of manual assignment 

The online grocery delivery problem is complex and multilayered.

There’s intense competition; each player elbowing their way through the crowd by promising faster deliveries. Then there are the rising expectations of customers — more options, less time, no contact and so forth. In such a scenario, managing asset utilization in a predictable way at scale brings its own set of challenges. Optimizing dark stores/depots and vehicle fleets as per every city’s infrastructure is no easy task either.

Add to this the inefficiencies of manual assignment.

Even today, many grocery services have a manual assignment process. The dispatch team manually assigns delivery bikers to active orders, including pooling orders and pinning depots/dark stores to each order set.

This is not feasible at scale.

Let’s understand this with an example. Indian food delivery company Swiggy’s Instamart grocery delivery service received 17,662 orders in 30 minutes during dinner hours on New Year’s Eve 2021, as per news reports. That’s nearly 600 orders per minute!

During regular operations, they process approximately 1 million orders per week. As you can imagine, manually assigning riders to each of these orders would destabilize every delivery performance KPI.

The online grocery surge

In densely populated urban cities like London, Paris or Mumbai, the grocery depots/dark stores are spread across the city. The delivery vehicle fleet usually consists of regular bikes, cargo bikes and EVs that are governed by different traffic laws and regulations (accessible lanes, speed limits, etc) compared to cars or other vehicles.

In addition, these services witness increased load during a short time window (the highest demand for groceries happens around lunch hours, dinner hours and weekends) with same-hour order fulfillment schedules.

Meeting the 10-15 minutes delivery promise with all these factors in mind would be impossible unless deliveries are automated and optimized.

Even with the best technology, a high-end platform, wide distribution networks, strong brand equity and unlimited financial resources, quick commerce businesses like grocery delivery will fail to generate long-term profits if operations are ineffective.

Geofencing can help simplify and streamline operations to ensure success.

What is geofencing?

Let’s start with the basics.

A geofence is a virtual perimeter of a real-world geographical area. It can be a convex or concave polygon defined by latitude and longitude pairs. It can be represented using different formats like GeoJSON, KML, Shapefile, etc.

Geofences with GeoJSON

In the map above, a triangular, rectangular and octagonal geofence each have been created with GeoJSON to define virtual borders of selected areas. An open standard geospatial data format, GeoJSON is used to represent points, lines, and polygon features, along with other properties.

In most cases, geofences help to track location-aware devices entering or exiting a geographical area.

For example, an IoT device providing the location of trucks will send out an alert when the truck is entering the geofence of a depot or a corridor along the route. It will also send out an alert if the truck leaves the corridor.

But geofences can help to do a lot more than just tracking. We’ll explore how it can be used to improve delivery operations and, in turn, the unit economics of a grocery delivery business.

Creating dynamic geofences with custom rules

For grocery delivery operations in cities, we want to assign orders to delivery bikers in such a way that it minimizes the overall travel distance or time. With the large number of dark stores and the geographical distribution of orders across a given city, one way to approach this problem is by simplifying it.

Instead of taking into account all the orders and all the dark stores in a city at a given time, why not divide the city into smaller zones, each centered around a dark store with a set of bikers assigned to each store?

The question then becomes, how can we designate meaningful zones for deliveries? Creating isodistance or isochrone geofences is an effective approach.

An isochrone map showcases all the areas accessible from a specific point (the dark store) within a certain time window.

For example, the map below depicts the number of drop-off points a delivery rider can reach within 5 and 10 minutes from a selected dark store/warehouse. Drawing a straight line between a starting point and a destination would give us the most direct route. But when traveling by road, we don’t drive as the crow flies.

Isochrone map

To compute this perimeter, we take into account:

  • The desired maximum travel time to service the orders
  • Vehicle type (car, bike, scooter, etc.)
  • Historical traffic
  • Real-time traffic

Isodistance maps are built on the same concept, but here ‘time’ is replaced by ‘distance’. For example, the map below depicts all the possible locations (drop-off points) that are within 1000 and 2000 meters (bike ride distance) from a selected dark store/warehouse.

Isodistance map

To compute this perimeter, we take into account:

  • The desired maximum travel distance to service the orders
  • Vehicle type (car, bike, scooter, etc.)

For the grocery delivery use case in cities specifically, isodistance works better than isochrone because the typical vehicles used are bikes, cargo bikes or e-bikes. These vehicles are not as affected by traffic as cars or trucks, and they have access to dedicated bike lanes, so distance is a better optimization metric than time.

The GIF below demonstrates how dynamic isodistance geofences are created in GeoJSON after defining the fence parameters in the API request.


Generating geofence in GeoJSON

Using API endpoints, companies can dynamically generate multiple geofences in varying sizes as per their business requirements.


Geofences for each order pool

Assessing the size of each fence is a business decision that could be dependent upon:

  • Number of delivery riders per depot/dark store
  • Delivery vehicle’s order fulfillment capacity (for example, a regular bike can fulfill 3 orders, cargo bike can take up to 5)
  • Historical average orders for a given depot
  • Road attributes like slopes, two-wheeler roads, etc.
  • Dark stores assigned to/preferred by specific bikers
  • The time of the day (lunch vs. dinner), day of the week (business days vs. weekends)

These geofences can be dynamically created based on the variability (number of riders available) of the parameters listed above.

Once geofences have been set, they can be used to automatically assess which geofence a particular order belongs to. All the orders that fall into specific geofences will be pooled for further delivery optimization within that geofence.

If an order falls into overlapping geofences, custom rules can be applied to automatically assign the geofence it should fall under. These rules could assess:

  • Number of bikers available at the depots/dark stores of overlapping fences
  • Number of orders in each geofence
  • Delivery vehicle’s order fulfillment capacity
  • Inventory availability at the depots/dark stores

Dynamic geofences help simplify the order pooling process, i.e., allocating orders to the appropriate dark store. This solves the first part of the problem. Now let’s move on to the second — i.e., assigning each biker a set of orders and optimizing the delivery sequence of these orders.

Pairing geofences with’s Distance Matrix API


Automated order assignment

Getting order assignment and the fulfillment sequence right is the most important part of solving grocery delivery’s operational challenges.

With dynamic geofencing, you can account for operational constraints and assign a geofence to each set of orders and dark stores. But to optimize dispatch, order assignment and the sequence of order fulfillment, you will need’s large Distance Matrix API.

The API would help compute the fastest, shortest and most efficient routes for your delivery fleet to reach customers within the promised time. With the ability to handle a 5000*5000 matrix size, you can compute optimal routes for as many origins and destinations as your business needs in real time.

The output of the Distance Matrix API can be fed into a Capacitated Vehicle Routing Problem Engine (the Solver) to generate the order grouping per biker along with the optimal order sequence for each delivery group.

By combining the power of dynamic geofences with our Distance Matrix API, we help grocery delivery businesses ensure that all on-time delivery KPIs are met without putting a strain on operations.’s Distance Matrix API in action

Geofences also enable companies to gauge the size of the vehicle fleet needed in a city/area and add the right type of vehicles (for instance, add more EVs in areas with difficult road networks like steep slopes). Grocery delivery services can also understand if they need to expand or trim down the size of the driver fleet to meet demand in certain geographies during specific hours of operation.

Increase operational fluidity

The biggest USP of optimizing route operations with dynamic geofencing and our Distance Matrix API is that you can customize and reset the route parameters as and when needed — even if it means resetting the parameters multiple times in a day.

The geofences can be recreated and the routes can be recomputed based on the:

  • Number of delivery drivers available per shift
  • Sharp incline/decline in orders
  • Types of vehicles available (EV vs. cargo vs. regular bikes)
  • Inventory availability
  • Real-time traffic updates

The underlying concepts of dynamic geofencing can be applied to other use cases and industries, such as ride-hailing, food delivery, e-commerce and hyper-local courier services.

If you’d like to maximize the operational efficiency of your quick commerce business via dynamic geofencing and AI-powered Distance Matrix API, reach out to us today! Our map APIs and tools have helped many companies turn their on-demand delivery business into profitable ventures, without burning through cash. Your business can be the next one!

About Author

Jim Welch

Jim Welch is the Head of Solutions Engineering at, where he leads a talented team in delivering scalable mapping and location solutions that drive sales results. With a career spanning over three decades, Jim has an extensive background in multi-objective vehicle route optimization, location-based services (LBS), and cloud-native architectures.

Ready to get started?

Talk to Sales

Get routes that need no editing or on-road improvisations

Blog Img

Ready to up your game in scheduling, dispatch, and routing?

Request a Demo