Guides

Route optimization API: Plan efficient routes for vehicles, workers, and fleets

by

Radar Team

on

July 2, 2024

What is route optimization?

Route optimization is the process of finding the most efficient route through a series of waypoints.

For example, a delivery driver might have multiple dropoffs, and you might want to find the shortest and most fuel-efficient route.

Or, a worker might have multiple jobs, and you might want to find the most efficient sequence in which to complete the jobs.

While you can plan routes manually, this can be tedious and complicated. If you have a few vehicles with 10 stops each, there are literally millions of different route possibilities.

Often called the traveling salesman problem (TSP) or vehicle routing problem, computing an optimal route is notoriously challenging.

Instead, it can be much more effective to use a route optimization API or route optimization software. That's where Radar comes in.

Radar's routing APIs

Radar offers a full suite of enterprise-ready routing APIs, including a distance API, distance matrix API, route optimization API, route matching API, and directions API.

Our routing APIs are part of our broader Maps Platform, which also supports forward geocoding, reverse geocoding, address autocomplete, base maps, and more.

Our Maps Platform is also complemented by our industry-leading Geofencing Platform, which supports geofencing, trip tracking, and location spoofing detection. All of these are also useful for logistics, including delivery tracking, fleet tracking, workforce management, and more.

Try our route optimization API

Radar's route optimization API accepts a list of up to 10 coordinates to visit, a travel mode (car, truck, foot, or bike), units (metric or imperial), and geometry (linestring or polyline). It returns the optimal ordering and route for the specified travel mode.

For example, here's a sample API request:

curl "https://api.radar.io/v1/route/optimize?locations=39.54203729608787,-76.35648238388424|39.54132073208234,-76.32024355463209|39.52603227091757,-76.33263289796602|39.54745109611153,-76.34450601866110|39.54044492158528,-76.36164461027317&mode=car" \
  -H "Authorization: prj_live_pk_…"

And here's a sample API response:

{
  "meta": {
    "code": 200
  },
  "route": {
    "duration": {
      "value": 21.950591666666664,
      "text": "22 mins"
    },
    "distance": {
      "value": 44514.43712,
      "text": "8.4 mi"
    },
    "legs": [
      {
        "startLocation": {
          "latitude": 39.542037,
          "longitude": -76.356482
        },
        "endLocation": {
          "latitude": 39.526032,
          "longitude": -76.332632
        },
        "startIndex": 0,
        "endIndex": 2,
        "distance": {
          "value": 10997.37568,
          "text": "2.1 mi"
        },
        "duration": {
          "value": 5.166406666666666,
          "text": "5 mins"
        },
        "geometry": {
          "polyline": "oomljAvxlsp…"
        }
      },
      {
        "startLocation": {
          "latitude": 39.526032,
          "longitude": -76.332632
        },
        "endLocation": {
          "latitude": 39.54132,
          "longitude": -76.320243
        },
        "startIndex": 2,
        "endIndex": 1,
        "distance": {
          "value": 13015.09228,
          "text": "2.5 mi"
        },
        "duration": {
          "value": 6.280486666666667,
          "text": "6 mins"
        },
        "geometry": {
          "polyline": "ginkjAlf~qp…"
        }
      },
      {
        "startLocation": {
          "latitude": 39.54132,
          "longitude": -76.320243
        },
        "endLocation": {
          "latitude": 39.547451,
          "longitude": -76.344506
        },
        "startIndex": 1,
        "endIndex": 3,
        "distance": {
          "value": 10331.36516,
          "text": "2.0 mi"
        },
        "duration": {
          "value": 5.078681666666667,
          "text": "5 mins"
        },
        "geometry": {
          "polyline": "wclljA~}eqp…"
        }
      },
      {
        "startLocation": {
          "latitude": 39.547451,
          "longitude": -76.344506
        },
        "endLocation": {
          "latitude": 39.540444,
          "longitude": -76.361644
        },
        "startIndex": 3,
        "endIndex": 4,
        "distance": {
          "value": 10170.604,
          "text": "1.9 mi"
        },
        "duration": {
          "value": 5.425016666666667,
          "text": "5 mins"
        },
        "geometry": {
          "polyline": "a`xljA|iurpCa…"
        }
      }
    ]
  }
}

Developers can use the optimized route to sequence stops for a worker or vehicle.

Optimized route

Other route optimization alternatives

For technical teams looking for an API solution, Google Maps Platform, Mapbox, HERE, and others also offer route optimization APIs.

Radar is the all-in-one, cost-effective alternative. Route optimization pricing starts at $2 per 1K API calls and trip tracking pricing starts at $1.50 per monthly tracked user or device, with volume discounts available.

For less technical teams not looking for an API solution, logistics software like Samsara and Onfleet offer route optimization functionality.

The business impact of route optimization and trip tracking

Turvo, a transportation management system (TMS) for the supply chain, saved over 6 figures annually by switching to Radar Maps Platform.

Route, an e-commerce package tracking platform, saves over $1M annually.

Radar’s geolocation services are phenomenal. The data is incredibly accurate and the platform is consistently available. Accuracy and availability are what we value the most in a partner, and we can trust the entire platform. We found that Radar provides the same accuracy as other products on the market at a fraction of the cost. Radar’s APIs are simple to use and easy to integrate, which saved us time and allowed us to dedicate resources to other projects.

— Nick Lloyd, Senior Director of Software Engineering, Route


To learn more, check out our docs, get started for free, or request a demo.

It's time to build

See what Radar’s location and geofencingsolutions can do for your business.