OpenStreetMap Routing and Directions: Pros And Cons

A driving route calculated with Geoapify Routing API on OpenStreetMap data
A driving route calculated with Geoapify Routing API on OpenStreetMap data

Every day, thousands of people and businesses rely on routing services to plan their routes. So whether you're a small, medium, or big business, you probably need a routing service too - find optimal routes, plan delivery routes, schedule service work in multiple locations.

Routing services are part of well-known platforms such as Google Maps, Bing Maps, and TomTom. These services have been around for a long time, dictating their terms and prices. But OpenStreetMap Routing is changing the game!

In this post, we'll focus on OpenStreetMap Routing (or Directions) and see if you can and why you should choose it for your business. We also explore the pros and cons of using OSM-based routing to give you a thorough understanding of the topic. Finally, we introduce you to Geoapify Routing, which is based on OpenStreetMap and helps solve route calculation and optimization tasks.

Why are more and more companies switching to OpenStreetMap Routing?

It is no secret that more and more companies are shifting to OSM-based services and products. The reasons behind this shift are not hard to find: it's affordable, flexible, and permissive. Let's go deeper and look at each of these and other reasons in detail.

OpenStreetMap project and data

OpenStreetMap is a truly unique project! OpenStreetMap continues to grow at an incredible pace. The number of contributors steadily rises, and new data are being added. As the chart below shows, contributors to the OpenStreetMap project surpassed 8 million in 2021:

Accumulated registered users

Accumulated registered users according to OSM Wiki Statistics

  • This makes OSM geodata the most up-to-date and actively edited geodata source. In addition, the road network is very well covered, which is especially important for routing.
  • It's also important to note that OpenStreetMap data is very diverse - contributors have different points of view, interests, and hobbies. For example, some people map driving roads and essential features, while others focus on biking routes, hiking trails, and their properties. Here is an example of data that a tiny part of a road contains (Bubenholztunnel, Switzerland):
Tag nameTag value
alt_nameFlughafenautobahn
avz241
highwaymotorway
lanes3
layer-1
lityes
maxspeed100
nat_nameN11
old_nameA51
onewayyes
refA11
ssvz865N
surfaceasphalt
tollyes
tunnelyes
tunnel:nameBubenholztunnel
  • OpenStreetMap is a community project and not a business project, and so you have much more freedom in how you can use routing data and store it. You can find OSM License details on the OSM Foundation Wiki page >>

OpenStreetMap-based routing services

OSM-based routing is one of the mapping services in high demand. There are many companies offering products and solutions to the market there. One of them is Geoapify.

Thanks to the OpenStreetMap community, we have access to the already mapped road network data, and can focus all of our energy on creating a superior product and service on top of it. As a result, we keep our prices low and affordable. Additionally, we want to encourage the use of OSM data by offering free OpenStreetMap-based routing services to small businesses and non-commercials.

As well, we believe that open data and the results drawn from it should remain open. Hence, our conditions are very permissive - you can for example store and reuse calculated routes.

Why do some companies stay with Google Maps, TomTom, etc.

Traffic jam at 17:30 downtown Haikou City, Hainan Province, China

Traffic jam in Haikou City, Hainan Province, China

Well, the biggest reason is traffic-influenced routing, especially accounting for a live traffic situation.

OpenStreetMap focuses on the static features, and traffic conditions or schedules are normally out of scope. On the other hand, usually, traffic data is created and maintained by a commercial company. So if you need traffic or live-traffic data for your routing, then a pure OSM solution will not serve your purpose.

However, there are a few solutions that you may wish to try if you need routing with traffic data:

  • Because OpenStreetMap provides extensive details about roads and surroundings, it is possible to estimate the traffic flow. Geoapify's routing parameter traffic=approximated does precisely that.
  • Some companies provide traffic data, which can be licensed for specific regions. So if you need to focus on some particular area, try to find local companies that offer OSM routing with traffic.

Fortunately, a trend in recent years has shown that the number of municipalities and companies interested in having open traffic data collected in one place is rapidly increasing. For example, here is Graphhopper's collection of open traffic sources.

So it may happen that OpenStreetMap Routing will be enriched by traffic data very soon.

OSM-based Routing: Free or Not?

As the OpenStreetMap data is free and publically available, you would probably wonder if OSM routing is Free or not. In short, the answer depends on what you mean by "Free".

There are open-source routing solutions that theoretically let you start your routing service at no cost on licenses and adapt the software to fit your needs. Still, you need to consider hardware, maintenance, and upgrade costs.

Just a quick bit of info, the Valhalla routing engine, one of the least demanding, requires a server with at least 32 gigabytes of RAM and 2 terabytes of SSDs to support planet-wide routing with elevation and at least one full-time person who can do server and data maintenance. And if something doesn't work as expected, you're on your own to understand and fix it.

Open-source Routing Engines based on OSM

If you decide to run your own OSM-based routing server, here are the most popular open-source routing engines that work on OpenStreetMap data:

OSM Routing EngineLanguageNameDescription
Valhalla logo
C++ValhallaValhalla is a feature-rich, flexible, and fast routing engine. One instance of Valhalla can cover the whole planet. In addition, the Valhalla routing engine supports dynamic routing profiles, so you can easily add new profiles or extend existing ones. For example, you can create a new profile for super long-distance hauling or a heavy truck. But calculating long routes and isolines can take some time.
OpenTripPlanner logo
JavaOpenTripPlannerFocused on public transportation, allows you to calculate routes and isolines, and thus can be used in conjunction with customized GTFS data. Works for small regions and or city areas, however it is very difficult to scale it to support country or continent scale routing.
OpenSourceRoutingMachine logo
C++OSRMOpen Source Routing Machine (OSRM) is a high-performance routing engine offering turn-by-turn routing and time-distance matrices. The OSRM is very fast, but it requires profile data to be precalculated, and may require more than 128GB of memory.
Graphhopper logo
JavaGraphhopperGraphHopper is a fast and efficient routing engine written in Java that provides turn-by-turn instructions and many road attributes for a route between two or more points. Similar to Valhalla, the Graphhopper lets to define dynamic route profiles making you more flexible.

Depending on your needs and experience, one or another routing engine might suit you better. However, it is probably not the best option if you simply want to save money.

Geoapify Routing API: features & pricing

Geoapify offers OSM Routing as a service. We made our Routing API robust, feature-rich, and easy to use. We run Geoapify Routing on dozens of high-performance servers and can dynamically scale up to meet demand by starting additional cloud servers, making the system consistent, stable, and reliable.

The API works vis HTTP Get/Post and returns GeoJSON, JSON, or XML objects. For a demo of the API, check out API Playground.

Routing modes

Geoapify Routing supports many travel modes for driving, bicycling, walking, and public transport:

  • drive, light_truck
  • medium_truck, truck, heavy_truck, truck_dangerous_goods, long_truck
  • bus
  • scooter, motorcycle
  • bicycle, mountain_bike, road_bike
  • walk, hike
  • transit

For more information, please visit the Routing API documentation page.

Turn-by-turn navigation

Turn-by-turn instructions (or Directions) help create a navigation app that guides your users to their destination.

You receive basic driving instructions when you call the Geoapify Routing API without any additional parameters. However, if you add the details parameter, you'll receive detailed instructions:

"instruction":{
    "text":"Turn right onto Krausnickstraße.",
    "type":"Right",
    "transition_instruction":"Turn right.",
    "pre_transition_instruction":"Turn right onto Krausnickstraße.",
    "post_transition_instruction":"Continue for 300 meters.",
    "streets":[
      "Krausnickstraße"
    ]
}
Route details

The OpenStreetMap data has a lot of useful information about its road network. You can use this information to visualize routes while providing helpful labels or classify the roads based on speed limits or surface.

With the parameter details=route_details, you get more information about each route step. Here is an example of the additional data:

{
  "speed":30,
  "speed_limit":30,
  "truck_limit":30,
  "surface":"paved_smooth",
  "lane_count":1,
  "road_class":"residential",
  "name":"Krausnickstraße",
  "rightside":true,
  "traversability":"both",
  "elevation":39,
  "from_index":13,
  "to_index":20,
  "distance":278,
  "time":35.30002150537634,
  "instruction":{
     ...
  }
}
Route elevation profile

Another useful feature is altitude or elevation information which you can get with the details=elevation parameter.

Hiking route elevation profile from Thoiry, France to Chézery-Forens, France

Hiking route elevation profile from Thoiry, France to Chézery-Forens, France

Route elevation profiles are essential tools for hiking or biking routes. Using them, you can categorize the difficulty of any path by examining its "ups and downs".

It also helps figure out how much fuel you'll need on the trip or how far you can go on the battery for cars and trucks.

More APIs for routes and optimization

The Routing API is a member of the large Geoapify routing services family. These are other APIs based on OSM road network data. They offer a good set of tools to analyze routes and locations, find optimal travel plans and schedules:

  • Map Matching API - allows you to match GPS tracks to existing road network and get extended road details;
  • Route Matrix API - calculates a matrix of distances and travel times between multiple source and target locations;
  • Route Planner API - finds an optimal route between multiple locations and for multiple vehicles or agents to solve, for example, delivery planning task;
  • Isolines API - returns an area reachable from a location within a given time or distance; it shows how far one can go from a given location.
Pricing

Geoapify's location platform is a cost-effective solution for any business. We have a variety of Pricing Plans that let you choose the one that best suits your needs.

Not sure how many routes you'll run? Then start for Free! You can try the API and evaluate Geoapify against your requirements.

The Pros and Cons of Using OpenStreetMap Routing

OpenStreetMap is an promising alternative to proprietary map databases. We went through the main aspects of OpenStreetMap-based routing services and checked their strong and weak side. Then, let's gather their pros and cons in a summary table:

ProsCons
Affordability

Based on community-driven OpenStreetMap data, OpenStreetMap Routing is usually more affordable than services based on proprietary data.

Up-to-date

Millions of people contribute to OpenStreetMap, making it an extremely up-to-date map.

Permissive

The OpenStreetMap data is open, so the routes built from it are assumed* to be open too.

*To be sure, read the terms and conditions of a service provider

Information-rich

OpenStreetMap contains lots of valuable information for routing applications - road surface, road class, speed limits, etc.

Powerful and flexible

OpenStreetMap Routing doesn't limit you to some travel modes, like driving, biking, walking, but enables defining custom modes, such as delivery robots, campers, e-drive.

Large number of providers

OpenStreetMap is available to everybody so that many companies can offer OSM-based routing services and APIs. That way, you have the best conditions at your disposal.

No Traffic data

OpenStreetMap doesn't contain traffic data by design, so there is no standard way to add it to the OpenStreetMap Routing solutions.

But the availability of open traffic data is growing. In addition, estimating traffic flow by using vehicle registrations can also be a feasible alternative to direct observation.

No Live traffic

Live traffic needs to be collected from end-user devices, such as mobile network providers tracking the locations of phones, apps like Google or Facebook using location data, or navigation systems with SIM cards. And this is definitely out of the scope of OpenStreetMap.

Live traffic is proprietary data that belong to certain companies. They may provide OSM-based traffic but you need to read their terms of use for details.

We've identified some pros and cons here, but there's no way to know if they apply to you or your business requirements. The choice is ultimately yours; OSM provides a good alternative if you're looking for one.