Building a routing and distance API for Bangladesh: what we learned
How we built road distance, drive time, motorcycle routing and geocoding for Bangladesh on open data: missing village roads, Dhaka speeds, admin areas and more.
By Wayline Engineering · · Updated · 4 min read
Bangladesh is the first region Wayline serves with every API: distance, routes, distance matrices, route optimization, snap to road, geocoding and reverse geocoding. It is also one of the hardest places we know of to get road distance and drive time right from open data. This post explains the problems we hit and how the Bangladesh coverage works today, so you can judge whether it fits your use case.
Problem 1: roads that are not on the map
OpenStreetMap coverage of Bangladesh is excellent in Dhaka, Chattogram and the other divisional cities, and much thinner in rural unions. A routing engine can only use roads it knows about. When a delivery address or a shop sits on an unmapped village road, the engine snaps the point to the nearest mapped road, which may be a kilometer away, and the route ends with an invisible straight line.
What we did: before building the routing graph we merge roads from Microsoft Road Detections, an open dataset of roads detected in satellite imagery (ODbL, the same license as OpenStreetMap). Only stretches that are not already covered by an OpenStreetMap road are added, joined to the existing network, and tagged as low-class roads: narrow ones as tracks that only the motorcycle profile uses, wider ones as unclassified roads that cars can use too. The router still prefers mapped highways for long trips. The result: far fewer routes that end in a straight connector, and more realistic distances for last-mile trips in rural areas.
Every response still tells you how far each point was from the road it was snapped to (distance_to_road_meters), so you can flag addresses that remain off the network.
Problem 2: Dhaka is not Sylhet
A single speed per road class does not work in Bangladesh. A primary road in the Dhaka city core moves at a fraction of the speed of a primary road between two district towns. Using one table either makes Dhaka trips look impossibly fast or makes highway trips look absurdly slow.
What we did: drive times use three city tiers: the Dhaka city core, Greater Dhaka and other large cities, and everywhere else. Each tier has its own speeds per road class, reflecting how fast traffic usually moves during the day rather than posted limits. Left-hand traffic is modeled in the turn costs. The speed tables are calibrated from measured trips, never from third-party routing services.
Drive times are typical daytime estimates, not live traffic. At rush hour real trips take longer; many teams multiply our estimate by a factor learned from their own completed trips. Profiles and drive times documents the details.
Problem 3: most trips are on two wheelers
Riders, sales reps, collection agents and NGO field staff in Bangladesh mostly travel by motorcycle. A car profile gives them the wrong route on narrow roads and the wrong time almost everywhere.
What we did: Bangladesh has a dedicated motorcycle profile with its own routing graph. Pass profile=motorcycle (or bike, motorbike, two_wheeler) on distance, route, matrix, batch and optimization calls:
curl "https://api.wayline.cloud/v1/distance?origin=23.7461,90.3742&destination=23.7808,90.4067&profile=motorcycle" \
-H "Authorization: Bearer $WAYLINE_API_KEY"If you request a profile a region does not offer, you get 400 PROFILE_UNAVAILABLE, never a silent fallback to car routes.
Problem 4: addresses people actually use
Bangladeshi addresses mix area names, road numbers, landmarks and Bengali spellings. Field reports are filed by division, district, upazila and union, not by postcode.
What we did:
- The Geocoding API indexes OpenStreetMap places in English and Bengali (
lang=bn), plus villages from GeoNames and points of interest from Overture Maps where OpenStreetMap is thin. - The Reverse Geocoding API returns the closest place and the administrative areas containing the point, using Bangladesh Bureau of Statistics boundaries down to the union. One batch call labels up to 100 check-ins.
Problem 5: pricing that works for local businesses
Global map platforms price for US enterprise budgets. A delivery startup in Dhaka computing fees for every checkout, or a distributor planning 200 rep visits a day, quickly runs into bills that do not fit the margin.
Wayline runs its own routing engine on open data, so the cost per request is small and our pricing is a flat, published price per unit, with free units for every new account and no charge for errors. Prices are in US dollars and payment is handled by Paddle.
What it looks like in practice
| Use case | Calls | Units |
|---|---|---|
| Delivery fee at checkout | 1 distance (store → customer) | 1 |
| Assign the nearest of 10 riders | 1 matrix (10 riders × 1 pickup) | 10 |
| Plan a rep's 15 visits | 1 optimize (15 stops) | 15 |
| Label a day's 40 check-ins | 1 reverse-geocode batch (40 points) | 40 |
| Mileage for those check-ins | 1 batch distance (39 legs) | 39 |
For city-to-city figures, see the computed road distances between cities in Bangladesh, such as Dhaka to Chattogram.
Limits you should know about
- No live traffic or incident data yet.
- No transit or walking profiles.
- Map quality depends on OpenStreetMap; if you see a wrong route, send us the
request_idand we will fix the data upstream where we can.
Try it
Create a free account, use a test key, and send a few of your own Bangladesh coordinates. The field sales guide walks through planning a rep's day end to end.
Map data © OpenStreetMap contributors. Additional data: Microsoft Road Detections (ODbL), GeoNames (CC BY 4.0), Overture Maps (CDLA Permissive 2.0), Bangladesh Bureau of Statistics.