Guides
Field sales and rural visits
Plan a field rep's day: optimize visit order, get road distance and drive time per leg, and label check-ins with addresses and admin areas.
Field teams such as sales reps, merchandisers, collection agents and NGO field staff spend most of their day on the road, often on motorcycles and often far from cities. Four calls cover the usual workflow.
1. Plan the day: best visiting order
Send the rep's start (home or office) and the shops to visit. Wayline returns the order with the least total drive time and the distance and time of every leg. Billed as 1 optimize unit per stop.
curl -X POST https://api.wayline.cloud/v1/optimize \
-H "Authorization: Bearer $WAYLINE_KEY" -H "Content-Type: application/json" \
-d '{
"profile": "motorcycle",
"end": "start",
"stops": [
{"lat": 24.2513, "lng": 89.9167},
{"lat": 24.4833, "lng": 89.9667},
{"lat": 24.1480, "lng": 89.9450},
{"lat": 24.0560, "lng": 89.8780},
{"lat": 24.3833, "lng": 90.0167}
]
}'orderlists input indices in visiting order;legsgive each hop's road distance and time.end:"start"returns home,"any"(default) finishes wherever is best,"last"finishes at the last stop you sent (e.g. the office).- Up to 100 stops per plan.
distance_to_road_meterson each stop, plus thePOINT_FAR_FROM_ROADwarning, flags shops whose last stretch is not on the mapped road network. That's common for village shops reached on foot or by an unmapped path.
In a test with 8 upazila markets around Tangail, the optimized plan was 163 km instead of 280 km in the order given.
2. Use the right vehicle
Use profile: "motorcycle" (alias "bike") for reps on motorcycles. It obeys motorcycle restrictions mapped in OpenStreetMap, can use narrow and unpaved roads, and uses motorcycle speeds. See Routing profiles & drive times.
If you reimburse mileage, decide the profile once and keep it. Changing it changes the measured distances.
3. Tag every check-in with its address and area
At the end of the day (or as check-ins sync), send the GPS points in one batch. Each point comes back with its closest place and the administrative areas it lies in. Billed as 1 reverse_geocode unit per point in coverage.
curl -X POST https://api.wayline.cloud/v1/reverse-geocode/batch \
-H "Authorization: Bearer $WAYLINE_KEY" -H "Content-Type: application/json" \
-d '{"points": [[24.4833, 89.9667], [25.08, 89.43]], "types": ["street", "locality", "district", "city"]}'{
"results": [
{
"input_index": 0,
"status": "OK",
"place": { "formatted_address": "Tangail-Mymensingh Highway, Ghatail, Bangladesh", "distance_meters": 140, "...": "..." },
"admin_areas": {
"division": { "name": "Dhaka Division", "name_bn": "ঢাকা বিভাগ", "osm_id": 1 },
"district": { "name": "Tangail District", "osm_id": 2 },
"upazila": { "name": "Ghatail Upazila", "osm_id": 3 },
"union": null
}
}
],
"units_charged": 2
}- Territories and reports: group visits by
districtorupazilato see coverage per territory, or check that a rep stayed in their assigned area. typesskips shops and other points of interest, so you get the street or village name instead of a nearby pharmacy.- Rural points: when nothing is mapped within about 1 km, the search widens to 5 km automatically.
distance_meterstells you how far the named place is. - Union coverage is partial.
unionisnullwhere OpenStreetMap has no union boundary yet. Division, district and upazila are available almost everywhere in Bangladesh.
4. Mileage between check-ins
Use /v1/distance/batch with the day's check-ins in time order to get road distance per leg and the daily total. See Mileage for check-ins.
Tips for low-connectivity areas
- Queue check-ins on the device and send them in one batch when the signal returns. The batch endpoints exist for this.
- Responses are compressed (gzip/zstd) when the client supports it, which keeps them small on 2G/3G.
- Never put the API key in the mobile app. Call Wayline from your server.
Map data © OpenStreetMap contributors.