Help

New and Customizable Routing Profiles

For a long time, our GraphHopper Directions API offered routing profiles for different modes of travel like driving by car, bike, different sizes of trucks, or pedestrian walking. We gradually improved these profiles over the years, so they work quite well for many standard use cases. However, many of our customers also like to go beyond these standard profiles to cover more specific scenarios.

New Profiles

Recently, we added new routing profiles that are based on the existing ones but can be used to avoid motorways, toll roads or ferries, or explicitly allow private and delivery roads. We tested these new profiles over the summer with the help of some of our customers and as we got positive feedback it is now time to make them publicly available. The great thing about these new, more specialized, profiles is that they can be used for all of our APIs including the Matrix and Route Optimization API! Of course you can find all the details about the profiles we offer in our documentation.

Customizable Profiles

Although our many different routing profiles mostly fulfill the needs of our customers we are still determined to make our routing solutions ever more powerful. As the routing can be tweaked in so many different ways, we decided to introduce a new mechanism that goes far beyond selecting one of the available profiles. Our new, so-called customizable profiles allow you to adjust the routing calculations in a very flexible way.

For example with customizable profiles it is easy to slow down the speed of the standard car profile on certain types of roads, prevent cyclist routes to use steps, avoid certain areas, bridges and much much more. Every custom profile is based on one of the standard profiles, so you can take advantage of all our knowledge that went into these profiles, but at the same time you can adjust details about the routing behavior just as you need.

Let’s stick with the example of a bicycle profile that shouldn’t use steps, e.g. because it is a cargo bike or has a trailer attached to it so it cannot be carried. To realize this you send a POST request towards the /route endpoint, set the (base) profile you want to customize (bike in our example), and write a custom model in JSON language like this:

{
  "profile":"bike",
  "points":[[13.3921,52.52273],[13.391733,52.522864]],
  "ch.disable": true,
  "custom_model": {
    "priority": [{
      "if": "road_class == STEPS",
      "multiply_by": "0"
    }]
  }
}
The result of our customized routing request. The customized bike profile avoids the steps and takes a detour instead. You can try this example yourself here.

A very useful tool to try this or your own examples of custom routing is our interactive custom model editor that you can find on GraphHopper Maps. Here is a direct link to the customized bike example that avoids steps.

To find out more about this please take a look at the full API documentation and this blog post where we highlighted the benefits of customized profiles with many real world examples.

While this might not be news to those who use our open source GraphHopper routing engine where we introduced profile customization already some time ago, we are very happy to announce that this custom routing now also available to all our customers via our Routing API. We learned a lot from our open source community and improved the feature a lot since we first introduced it. So it is now time to make it available to a broader audience. There are still some limitations of this API that you should know of, so please also make sure to read this section of our documentation.

Customizable Matrix and Route Optimization API

One of our biggest goals has always been to not only offer a flexible Routing API, but also offer the same functionality for our matrix and route optimization calculations. We’ve made significant progress in this direction and can already offer you to participate in a closed alpha phase for this feature. Please contact us if you are interested.

Deprecation of Parameters for the Routing API

From today the parameters avoid, block_area and weighting are deprecated. Instead you should use the newly introduced custom_model as described above. Furthermore you should start using the profile parameter instead of the vehicle parameter.

Happy Routing!