Guide

Route optimisation for delivery fleets in Dhaka

Delivery fleets in Dhaka lose hours to badly ordered stops and riders sent across jams. This guide shows a practical approach with the GeoDesh Routes API, from the Dhaka-based maps platform billed in Taka: order stops, check them against real traffic and assign riders by travel time. It is also clear about what the API does not do.

30 November 2026 · 9 min read

Why Dhaka needs travel time, not distance

Two stops 3 km apart can be ten minutes apart at 11 am and fifty minutes apart at 6 pm. One-way roads, flyover ramps and the river crossings mean the straight line is a poor guide. Any plan that ranks stops or riders by distance alone will be wrong several times a day.

The GeoDesh Routes API returns durationInTraffic for driving routes and in the distance matrix, along with a typical trafficRange. That is what we use to score plans.

Three tools and what each does

EndpointWhat it doesLimitList price per 1,000
POST /v1/routes/optimizeOrders stops with nearest-neighbour from the first stop, on straight-line distance50 stops৳1,500
POST /v1/routes/matrixTravel time and distance in traffic for every origin × destination100 elements৳600
POST /v1/routesRoad route, distance and ETA in traffic through waypoints8 waypoints৳250

Be clear about the first one: it is a fast, cheap first ordering, not a full vehicle-routing solver. It does not model time windows, vehicle capacity or several vehicles. For a single rider with up to a few dozen drops it is a sensible start, and the other two endpoints let you check and improve it with real travel times.

Step 1: a first ordering

curl -X POST https://geodesh.com/v1/routes/optimize \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{ "waypoints": [
        { "lat": 23.7925, "lng": 90.4078 },
        { "lat": 23.7461, "lng": 90.3742 },
        { "lat": 23.8103, "lng": 90.4125 },
        { "lat": 23.7515, "lng": 90.3935 }
      ] }'
POST /v1/routes/optimize

The first waypoint is the start (the hub or the rider’s position). The response data.waypoints lists the stops in visiting order.

Step 2: improve it with real travel times

For runs of up to ten stops, one matrix call gives every stop-to-stop time in traffic (10 × 10 = 100 elements). A simple improvement pass then swaps pairs of stops while the total time falls. This 2-opt pass is a few lines of code and fixes most of the crossings a straight-line ordering leaves.

async function matrix(points) {
  const r = await fetch('https://geodesh.com/v1/routes/matrix', {
    method: 'POST',
    headers: { 'x-api-key': process.env.GEODESH_KEY, 'content-type': 'application/json' },
    body: JSON.stringify({ origins: points, destinations: points, mode: 'driving' }),
  }).then((x) => x.json());
  return r.data.rows.map((row) => row.elements.map((e) => e.durationInTraffic?.value ?? e.duration?.value ?? 1e9));
}

function total(order, t) {
  let s = 0;
  for (let i = 0; i < order.length - 1; i++) s += t[order[i]][order[i + 1]];
  return s;
}

function twoOpt(order, t) {
  let best = order.slice(), improved = true;
  while (improved) {
    improved = false;
    for (let i = 1; i < best.length - 2; i++) {
      for (let k = i + 1; k < best.length - 1; k++) {
        const next = [...best.slice(0, i), ...best.slice(i, k + 1).reverse(), ...best.slice(k + 1)];
        if (total(next, t) < total(best, t)) { best = next; improved = true; }
      }
    }
  }
  return best;
}

// points[0] is the hub; start from the optimize order, then improve on real times
const t = await matrix(points);
const order = twoOpt(points.map((_, i) => i), t);
Node.js: matrix + 2-opt on travel time

This keeps the hub first and the last stop free. For a round trip, append the hub again at the end before scoring.

Step 3: the road route and ETA

Directions accept up to 8 intermediate waypoints. For a run of ten stops, send the hub as origin, the last stop as destination and the eight in between as waypoints. The response gives each leg’s distance and duration, so you can show the rider and the customers an ETA per stop.

curl -X POST https://geodesh.com/v1/routes \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{ "origin": { "lat": 23.7925, "lng": 90.4078 },
        "waypoints": [{ "lat": 23.8103, "lng": 90.4125 }, { "lat": 23.7515, "lng": 90.3935 }],
        "destination": { "lat": 23.7461, "lng": 90.3742 },
        "mode": "driving" }'
POST /v1/routes with waypoints

Assigning riders

When an order comes in, send all free riders as origins and the pickup as the single destination in one matrix call. Assign the rider with the smallest durationInTraffic. With 20 riders that is one request of 20 elements, ৳0.60, instead of 20 directions calls.

Budget for a 50-rider fleet

CallPer dayPer monthList price
Rider assignment (matrix)2,00060,000৳36,000
Run ordering (optimize)2006,000৳9,000
Run improvement (matrix)2006,000৳3,600
Route and ETAs (directions)2006,000৳1,500
Total৳50,100

On the Business plan (৳24,999 a month, ৳40,000 credit, 30% off) the usage comes to ৳35,070, inside the credit, so the month costs ৳24,999. See pricing.

When you need more

  • Time windows, vehicle capacities or many vehicles at once need a vehicle-routing solver. Use the GeoDesh matrix as its travel-time input.
  • Very large runs (over 10 stops) need several matrix calls; split stops into areas first.
  • Re-plan during the day: traffic at 5 pm is not traffic at 10 am.

Zones before routes

Most Dhaka fleets work better when stops are first split into zones that follow the city’s barriers: the river, the rail lines and the big arterial roads. Optimise inside each zone, then assign zones to riders. It keeps each run under the ten-stop size where one matrix call covers it, and riders learn their zones, which saves time no API can measure.

Measuring whether it works

Track three numbers before and after: average delivery time, kilometres per delivery and late deliveries. Change one thing at a time, for example the 2-opt pass, and compare a week against a week. Optimisation that looks good on a map but does not move these numbers is not worth the extra calls.

Frequently asked questions

Does GeoDesh handle time windows?

Not in the optimize endpoint. Use the distance matrix as input to a solver that supports time windows if you need them.

How often should runs be re-planned?

When a new order arrives that fits a run, and at least at the start of each wave. Traffic patterns change through the day.

Start with ৳5,000 free every month.

Request an account and the GeoDesh team sets it up for your organization. Then make a key and your first call in minutes. Billed in Taka.