Map Matching API

Clean routes from GPS recordings.

Phones and GPS devices record tracks that are often off by several meters: they cut corners, jump between streets or end up in a river. The Map Matching API puts each recording back onto the streets and paths it was made on.

Recorded by the phoneAfter map matching
What map matching does

From a wobbly line to a route.

The API compares the recording with the streets and paths around it and works out which ones were actually used. Three things change:

Back on the path

Points that drift into a river, a building or the next street are moved back onto the way that was actually walked or driven.

Recording5.57 kmMatched5.39 km

The real distance

A wobbly recording zigzags and comes out longer than the walk itself. The matched route measures the streets and paths that were used.

Turn right onto Herzog-Friedrich-StraßeTurn right onto HofgasseTurn slight left onto Pfarrgasse

Directions and street names

The clean route comes with turn-by-turn directions and the names of the streets, which a raw recording does not have.

Live demo

Match your own recording.

A bike ride through the canals of Amsterdam, recorded with a phone and already matched to the right streets. Upload your own track or draw one on the map.

Upload a GPX, KML or GeoJSON file

Or click a track on the map

Match it for cycling, walking or driving

For developers

Send the recording, get a route.

Send the web address of a GPX file or the recorded points to the API. The answer has the same format as the Routing API, so anything that already shows a route can show the matched one.

The walk at the top of the page
const body = new URLSearchParams({
  gpx: "https://docs.maptoolkit.com/demos/innsbruck-walk.gpx",
  routeType: "foot"
});
const res = await fetch(
  "https://routing.maptoolkit.net/match?api_key=YOUR_API_KEY",
  { method: "POST", body }
);
const route = (await res.json()).paths[0];

The result is the dark blue route in the maps above: 5.39 km of streets and paths.

A GPX file or a list of points

Give the web address of a GPX file, or send the recorded points in order (point).

Same answer as the Routing API

Line, distance, time and directions, in the same format as a calculated route.

Long recordings via POST

A real recording has hundreds of points, so it goes in the request body.

Give it a little time

Matching takes longer than routing. Very long tracks are rejected, so split them into parts.

API key in the web address

The key always goes into the address, also for POST requests (api_key).

Directions in your language

Set the language of the directions, as on the Routing API (language).

Questions and answers

Questions about map matching.

Short answers on matching versus routing, GPX files, travel modes and road surfaces.

What is the difference between map matching and routing?

Routing answers the question of the best way from A to B. Map matching answers a different one: which streets and paths did this recording actually follow? Use the Routing API to plan a trip between known points, and the Map Matching API to clean up a track someone has already recorded. Matching a route you just calculated adds nothing.

Does my GPX file have to be online?

If you send a GPX file, yes. The API takes the web address of the file and downloads it itself, so the file has to be publicly reachable on the internet. A link behind a login, on localhost or on a private network fails. If your track is not online, send the recorded points directly in the request instead, in the order they were recorded.

Which travel modes can I match a track against?

You can match a recording to the walking, cycling or driving network. Walking is the default, so choose car whenever you match a drive, and bike for a ride. Otherwise a car trip is matched on the walking network and can end up on footpaths that no car could have taken.

Can I find out which road surfaces a recorded track runs on?

Yes. For that, use the Route Enhancement API. You send the track as a GPX or KML file or as GeoJSON. It matches the track to the road network itself and returns the surface and road type for each part, such as asphalt or unpaved. Parts it cannot match with confidence get the surface type other, which means unknown, not an unusual surface.

See your use case on a Maptoolkit map.

In the demo, one of our engineers walks you through the platform, your data and the move from your current provider.