openrouteservice API basics#
The openrouteservice (ORS) is much more than a website with a route service for cars, pedestrians and bicycles based on Open Standards and Open Geodata. Several Location Based Services (LBS) created from OSM data are available.
Website / Maps Client#
The ORS Maps Client allows you to do “normal” routing and isochrones. You can choose between several “profiles” for different modes of transportation, e.g. car, bicycle or pedestrian. Exploring the maps client is a good way to find out what ORS offers.
Quick-Exercise
Go to https://maps.openrouteservice.org/#/ and calculate a route for a pedestrian between the cities of Heidelberg and Neckargemünd passing by the Klosterhof brewery. Investigate the extra information such as elevation profile for the route.
Documentation of the openrouteservice API#
Openrouteservice provides an API which allows you to embed routing requests in more complex workflows. The API documentation describes how the api can be used and offers a “playground” to send request interactively. Make sure to first sign up and create an account.
As for other APIs there are several endpoints, which will be suited for different types of analyses. Here we will mainly focus on the following endpoints:
Directions
Isochrones
Directions#
This is the “standard” routing endpoint to calculate a basic route between two or more points.
the routing profile (e.g
driving-car
,cycling-regular
,foot-walking
,wheelchair
, …) can be adjusted in the path parametersadditional options can be passed using the
options
parameters
You find some examples here. This offers you the possibility to avoid specific roads, custom defined areas or countries during routing.
Isochrones#
Reachability (or also called accessibility) has become a crucial component for many businesses and researchers from all different kinds of domains. To this end, you can use openrouteservice to obtain isochrones which will help you determine which areas objects are able reach in given times or distances.
similar to “standard” routing you need to specify a routing profile
the
range
attribute defines for which classes the isochrones will be calculated (e.g. 5min, 15min, 30 min)make sure to set the
range_type
accordingly to eithertime
ordistance
openrouteservice-py#
The openrouteservice python library gives you painless access to the openrouteservice (ORS) routing API’s. You can find example queries in the documentation.