
Blog
Isochrones are a useful way to show all the locations that can be reached within a time limit and by a mode of transport, displayed on a map.
You can use isochrones in your website or app to allow users to search for the locations they can reach within their preferred travel time and by their preferred transport mode.
In this tutorial, you’ll learn how to create isochrones and integrate them into your application using the TravelTime Isochrone API.
To follow along with the tutorial, you’ll need the following:
The TravelTime API accepts JSON requests and returns a JSON response. On the front end of your application, users can enter the parameters of their search, including:
You can try this for yourself in our Isochrone API Playground.
Once the request is made, the Isochrone API receives the request and returns a JSON response. The response includes coordinates for points showing the boundaries of shapes reachable within the travel time.
These results can then be displayed on your application or on a map like the example below:
The code sample below shows how to visualise a travel time response.
It shows locations within 1 hour from The White House, Washington DC by public transport.
The JSON response includes coordinates. These points show the boundaries of shapes reachable within the corresponding travel time.
Now let’s visualise this response on a map.
The image below shows how this response would be displayed on a Leaflet map.
We'll need to do the following three things:
Since this code runs only in the browser, we have removed API key from the sample. Like with the JSON request, the code must have headers. These headers are needed to authenticate the request and usually sit on the server side of your app.
For the start location, we specified The White House. However, the API only accepts coordinates of a location.To change the address into coordinates, we can use the TravelTime geocoding endpoint.
The function below sends a request for the geocoder:
Now that we have everything we need for the request, we can write the code that would generate the request.
Finally, we need to call a function to set up a map with a marker at the departure location.
A separate function is used to draw the multipolygon from the response to reflect the isochrone.
You can use the TravelTime Isochrone API to allow users on your website or app to search for and view the locations they can reach within a specific travel time.
For example, property website, Zoopla, uses the API to help their users visualise potential propertiesin locations within their desired travel time.
Similarly, Foxtons also allows users to search for properties within a maximum travel timefrom their workplace:
With the TravelTime Isochrone API, you can enable your users to search for locations by travel time for any mode of transport, including public transport, cycling and walking.
Coupled with the TravelTime Matrix API, you can also rank and filter thousands of location search results by travel time.
Additionally, TravelTime supports over 100 countries worldwide. You can see all of our supported countries here.
Check out our documentationto learn more about what you can do with the TravelTime API or sign up for a free API key.
Related content