Map Matching is ready to Flex

We’re excited to release Mapzen Map Matching, the latest addition to the Mapzen Mobility services. Our Map Matching service takes in a trajectory of latitude/longitude coordinates and returns back a route line that is snapped to the OpenStreetMap road network and enriched with attributes, like speed limits and freeway exit signs.

animated map showing a route being matched in the SF Marina neighborhood

Mapzen Map Matching can be used to power many applications, from GPS fitness trackers to heads-up navigation displays. Starting today, it’s available through a generous free tier to all developers and with the simple pricing of Mapzen Flex for heavier users.

In this blog post, we’ll provide some more examples of what Mapzen Map Matching can do. We’ll explain its two specific functions: trace_attributes and trace_route. And we’ll provide all the information you need to start using Mapzen Map Matching yourself in the Mapzen Mobility Explorer client and directly from the Map Matching API!

Trace Attributes

Let us state a few scenarios to better describe our trace_attributes functionality…

Are you on a road trip and are wondering about what lies ahead? Are you curious about the speed limit or tolls along your trip? Maybe you are visiting your grandmother, who uses a wheelchair, and would like to take her out for a stroll. Wouldn’t it be useful to know the upward or downward slope along your walking route?

A few common inquiries on attributes along a route:

  • Types of bike lanes
  • Signage information for exits (exit name, exit number, exit branch)
  • Speed limits
  • Maximum upward or download slope along the bike or walking route
  • Any tolls, tunnels, or bridges along the route
  • Any unpaved sections of roads

The trace_attributes action can give you these sorts of localized descriptions of your current route segment or a portion of what is ahead on your route. Here’s a full list of the attributes that can be requested. In addition, trace_attributes queries return the matched shape path, which you can use to draw on a map:

animated map showing speed limits along a route in Hershey, PA

( Open full screen ➹ )

Trace Route

Ok, so now that you get the gist of trace_attributes, let us move on to our second really awesome trace_route function.

It’s going to be a beautiful weekend, perfect for an outdoor adventure. It could consist of hiking, biking or just a nice drive in the country to unwind from the hectic work week. What if your amazing adventure could benefit someone else? How many times have you found a great path or route that you would love to record to use again or even share with others?

The trace_route action allows you to do just that. Our service can take the trajectory points and match them to a Valhalla route path, along with providing you a step-by-step navigation for your map-matched path (just like a route planned using Mapzen Turn-by-Turn).

What’s even better is that you can now visualize these cool new features within our Mobility Explorer! The Explorer will allow you to upload your favorite GPX trace to test out our Map Matching service. (GPX is a common file format that many GPS loggers, running watches, and other consumer electronics can output.) The Mobility Explorer will first perform a trace_attributes on your trace and can provide you with a clickable route highlight based on speed or grade to display various attributes along your path. If there are no errors in the matched data, the Explorer will also provide you with navigational output for the matched route. Please try them out for yourself!

animated map showing gradients along a bike route in Maryland

( Open full screen ➹ )

Your mileage may vary

Map matching is a probabilistic process. Depending upon the accuracy and precision of the data coming in, there is always some chance of error in the match data that our service will send back. When errors do occur, our Map Matching service will provide as much information as possible to help you understand the source of the error and how you may be able to fix it. The results may be incomplete because there are no lines to match to the underlying OpenStreetMap source data. When the match produces an error or a discontinuity, you can style the segments by attribute but you will not be able to get turn-by-turn directions for your route

Here is an example from the Mobility Explorer of an unsuccessful match. The Mobility Explorer will output a list of unmatched segments, along with links to zoom to them on the map and see the areas in OpenStreetMap:

animated map showing a map-match discontinuity in SF Golden Gate Park

( Open full screen ➹ )

Suggestions for improving your results

Follow these guidelines to improve the Map Matching results.

  • You should have good GPS accuracy, with a clear view of the sky and as many satellites as possible. Of course, this can be difficult in dense urban areas.
  • Make sure the trace point density is within the approximate range of one per second and one per 10 seconds. The greater the range between them, the more chance of inaccurate results.
  • Have each trace represent one continuous path.
  • Verify that there is a corresponding match with the OpenStreetMap network. If there are missing roadways/paths or improper connections, you can always use your local knowledge to fix and improve OpenStreetMap!

Did Someone Say Open Traffic?

The Mapzen Map Matching service has many more applications. We’re also using the service to turn raw GPS probe data from vehicles into traffic speed statistics. The Open Traffic platform collects these traffic speed statistics from around the globe, in a manner that protects the privacy of individuals and companies that contribute their anonymous location data.

Read more about Open Traffic, a collaboration between the World Bank, Mapzen, and ride-sharing companies around the world.

A Note of Appreciation

Finally, we’d like to thank Mapillary and especially Tao Peng. Valhalla’s core map-matching component (called Meili) has been a collaborative creation with them since the start. Also, we’d like to give a tip of the hat to Paul Newson and John Krumm, creators of the Hidden Markov Model approach to map-matching while at Microsoft Research in 2009—it’s this approach that we’ve implemented in Meili. Just like all of Valhalla, Meili is open-source. We look forward to continuing to make improvements to its abilities and applications with our friends at Mapillary and any other contributors who want to join us on GitHub!

We have a thorough explanation of our Map Matching Service that you can access by going to our Map Matching documentation. You can also view a live demonstration of our Map Matching Service by trying out our Mobility Explorer. We love feedback so send it our way!

Map Matching is available immediately through Mapzen Flex, with a generous free tier and simple and understandable prices if you need to match and get attributes on even more routes.