Guides

Route matching API: Snap coordinates to maps and road networks

by

Radar Team

on

July 2, 2024

What is route matching?

Route matching, also called map matching or "snapping to roads," is the process of aligning GPS coordinates with a road network factoring in direction of travel, speed limits, and other information.

Matching GPS data to a road network allows you to better display or analyze routes and has many practical applications, from fleet management to mileage tracking to consumer apps.

To perform route matching, you can collect GPS data from a device using Radar's location tracking SDK or another tool, then process it through Radar's route matching API.

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 matching API

Radar's route matching API accepts a list of GPS coordinates, a travel mode (car, truck, foot, or bike), units (metric or imperial), geometry (linestring or polyline), and a list of road attributes to include in the response (including speed limit, names, and road class). It returns the matched route and road attributes.

For example, here's a sample API request:

curl "https://api.radar.io/v1/route/match?path=39.52281357775789,-76.3576689589747|39.52426355124601,-76.35636357386929|39.5259417235051,-76.35465787066539|39.52557924173118,-76.35350913177254|39.52425012570481,-76.35124646425682|39.52482742164926,-76.34938411484032|39.52703452988416,-76.34878890349742|39.52848288372829,-76.34955708170284&mode=car&units=imperial&roadAttributes=names,speedLimit,roadClass" \
 -H "Authorization: prj_live_pk_..."

And here's a sample API response:

{
  "meta": {
    "code": 200
  },
  "matchedPath": [
    {
      "latitude": 39.522903,
      "longitude": -76.35782,
      "originalIndex": 0
    },
    {
      "latitude": 39.524304,
      "longitude": -76.356432,
      "originalIndex": 1
    },
    {
      "latitude": 39.525964,
      "longitude": -76.354689,
      "originalIndex": 2
    },
    {
      "latitude": 39.525612,
      "longitude": -76.353474,
      "originalIndex": 3
    },
    {
      "latitude": 39.524276,
      "longitude": -76.35122,
      "originalIndex": 4
    },
    {
      "latitude": 39.524806,
      "longitude": -76.349336,
      "originalIndex": 5
    },
    {
      "latitude": 39.527029,
      "longitude": -76.348705,
      "originalIndex": 6
    },
    {
      "latitude": 39.528426,
      "longitude": -76.349657,
      "originalIndex": 7
    }
  ],
  "distance": {
    "value": 4783.668263313601,
    "text": "0.9 mi"
  },
  "geometry": {
    "polyline": "odhkjAvjospCeBeBuAwA_Ay@cWmU}LoLqDkEyBcCmBsBeMqMcC}BgCgCgDeD}IyIsOoOwAcEmBmCeDuCoEoE_JsI}GoGeJqIoJuI{IwIiBmEiAaB{BuCw@oBk@sCByEfAoFdAcEv@{DtgAqvBzIaRnK{TzU_g@jNyYxBsEcJwHgCiCaKwJgKuJyEoEuQwPeGuFiGeEwEiBqFsBcE{@qIqA}FS}`@EqEa@yIeAwFqAqGeBgEoAoEo@qFYaBHwAT{D^}Cl@{Bn@eEpBaEvCy^p\\kQdP"
  },
  "roadAttributes": [
    {
      "roadClass": "primary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "Baltimore Pike",
        "US 1 Business"
      ],
      "startLocation": {
        "latitude": 39.522904,
        "longitude": -76.35782
      },
      "endLocation": {
        "latitude": 39.522998,
        "longitude": -76.357725
      },
      "originalIndex": 0
    },
    {
      "roadClass": "primary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "Baltimore Pike",
        "US 1 Business"
      ],
      "startLocation": {
        "latitude": 39.524289,
        "longitude": -76.356448
      },
      "endLocation": {
        "latitude": 39.52473,
        "longitude": -76.356011
      },
      "originalIndex": 1
    },
    {
      "roadClass": "primary",
      "speedLimit": {
        "value": 70,
        "text": "70 mph"
      },
      "startLocation": {
        "latitude": 39.525872,
        "longitude": -76.354845
      },
      "endLocation": {
        "latitude": 39.526074,
        "longitude": -76.354488
      },
      "originalIndex": 2
    },
    {
      "roadClass": "trunk",
      "speedLimit": {
        "value": 40,
        "text": "40 mph"
      },
      "names": [
        "MD 24",
        "Vietnam Veterans Memorial Highway"
      ],
      "startLocation": {
        "latitude": 39.525973,
        "longitude": -76.354067
      },
      "endLocation": {
        "latitude": 39.524636,
        "longitude": -76.351849
      },
      "originalIndex": 3
    },
    {
      "roadClass": "trunk",
      "speedLimit": {
        "value": 40,
        "text": "40 mph"
      },
      "names": [
        "MD 24",
        "Vietnam Veterans Memorial Highway"
      ],
      "startLocation": {
        "latitude": 39.524636,
        "longitude": -76.351849
      },
      "endLocation": {
        "latitude": 39.52407,
        "longitude": -76.350859
      },
      "originalIndex": 4
    },
    {
      "roadClass": "tertiary",
      "speedLimit": {
        "value": 35,
        "text": "35 mph"
      },
      "names": [
        "Marketplace Drive"
      ],
      "startLocation": {
        "latitude": 39.523763,
        "longitude": -76.350324
      },
      "endLocation": {
        "latitude": 39.523941,
        "longitude": -76.350168
      }
    },
    {
      "roadClass": "tertiary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "Marketplace Drive"
      ],
      "startLocation": {
        "latitude": 39.523941,
        "longitude": -76.350168
      },
      "endLocation": {
        "latitude": 39.524009,
        "longitude": -76.350099
      }
    },
    {
      "roadClass": "tertiary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "Marketplace Drive"
      ],
      "startLocation": {
        "latitude": 39.524806,
        "longitude": -76.349336
      },
      "endLocation": {
        "latitude": 39.525397,
        "longitude": -76.348973
      },
      "originalIndex": 5
    },
    {
      "roadClass": "tertiary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "Marketplace Drive"
      ],
      "startLocation": {
        "latitude": 39.526341,
        "longitude": -76.348902
      },
      "endLocation": {
        "latitude": 39.5271,
        "longitude": -76.348698
      },
      "originalIndex": 6
    },
    {
      "roadClass": "tertiary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "South Atwood Road"
      ],
      "startLocation": {
        "latitude": 39.5271,
        "longitude": -76.348698
      },
      "endLocation": {
        "latitude": 39.528133,
        "longitude": -76.349383
      }
    },
    {
      "roadClass": "tertiary",
      "speedLimit": {
        "value": 30,
        "text": "30 mph"
      },
      "names": [
        "South Atwood Road"
      ],
      "startLocation": {
        "latitude": 39.528133,
        "longitude": -76.349383
      },
      "endLocation": {
        "latitude": 39.528427,
        "longitude": -76.349658
      },
      "originalIndex": 7
    }
  ]
}

Developers can use the response to analyze or display the matched route.

Matched route

Other route matching alternatives

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

Radar is the all-in-one, cost-effective alternative. Route matching 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.

The business impact of route matching and trip tracking

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

Fi, a smart dog collar app, also saved over 6 figures annually.

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.