Isochrone API tutorial to create an isochrone map

by Niharika Sisodia
on Jul 13, 2018 10:32:00 AM

What is an isochrone?

An isochrone shows reachable areas on a map within a travel time and by a mode of transport. The TravelTime platform allows you to create isochrones. You can also integrate them into any isochrone app using an API.

The isochrone API process

To create an isochrone, the user enters the parameters of their search, including:

  • departure or arrival location
  • mode of transport
  • travel time limit
  • time of the day

This is a simple JSON request or using settings on your isochrone app. The image below is a client user interface for entering parameters. 

Isochrone_API

Once the request is made, the isochrone API receives the request and returns a JSON response. The response includes coordinates for points. These points show the boundaries of shapes reachable within the travel time.

These results can then be displayed on your isochrone app or a map. The example below shows an isochrone map, which is calculated using our TravelTime Search API.

Isochrone_API

 Isochrone maps are a great way to visualise locations you can reach within a certain travel time. The travel time limit for our isochrones is up to 4 hours. Our TravelTime Search API can also calculate times for up to 10,000 locations by travel time in under 500 msLearn more.

How do I use this isochrone API?

The code example below shows how to visualise a travel time response. It shows locations within 1 hour from The White House, Washington DC by public transport. This example uses the TravelTime Search API and its isochrone algorithm.

Request an API key

To make an isochrone, you’ll first need to request a key. You can request an API key for the TravelTime Search API by clicking here and entering your details.

GET AN API KEY

Isochrone request and response

API accepts JSON request and returns a JSON response. 

The JSON response includes coordinates. These points show the boundaries of shapes reachable within the corresponding travel time. 

This response has to be visualized on a map. Let’s explore a sample code that could do that.

Map the response in your isochrone app

Isochrone_algorithm

The image above shows how this response would be displayed on a Leaflet map. It can be implemented using any programming language or mapping system you prefer. This is the simplest way to generate a request and display a response using Javascript.

Let’s break down the code for better understanding.

First, we need to define parameters for the search. We’ll need to change the name of the start location (The White House) into coordinates using a geocoder. Secondly, we need to change the departure time into the ISO format. Finally, we need to translate the 1 hour travel time into seconds which is 60 minutes x 60 seconds.

Since this code runs only on 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 starting location, we specified The White House. However, the API only accepts coordinates of a location. To change the address into coordinates we use the Geocoder 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.

The full code looks like this: 

What does this mean for your isochrone app?

An isochrone API means customers can search for your products and services by time.  For example, Zoopla created an isochrone app using the TravelTime Search API. This helped their users visualise potential properties. Zoopla has seen an increased conversion rate of 300%.

Isochrone_app

Which countries does the isochrone map generator support?

Australia  Germany Norway
Austria Hungary Poland
Belgium Ireland Portugal
Canada Israel Spain
Czech Republic Itlay Sweden
Denmark Latvia Switzerland
Estonia Lithuania United Kingdom
Finland Luxembourg United States
France Netherlands  

 

Sign up for an isochrone API key now and start using The TravelTime Search API within 24 hours. To learn more about the Travel Time Search API and isochrone maps, visit our Time Map Resource page.

SIGN UP FOR TRAVELTIME SEARCH API KEY

 

Related

TravelTime case study: healthcare development analysis

The Megahospital challenge is a tool created using the TravelTime API by Border City Data. See how the app was built for healthcare development analysis.

Niharika Sisodia Apr 8, 2019 9:08:00 AM
READ

Google Distance Matrix API vs. the TravelTime Search API

Google Distance Matrix and TravelTime Search both calculate travel times and distances from one to many points of interest. Compare the API features and pricing.

Niharika Sisodia Jan 28, 2019 4:04:45 PM
READ

10 brick and mortar store locator pages for inspiration

Get inspired by brick and mortar store locator pages. View store locator pages from top global retail brands. Attract customers to your brick and mortar store by creating an effective store locator page design.

Niharika Sisodia Dec 20, 2018 10:21:18 AM
READ

How to convert visitors into customers using map view

Improve your map UI. Perfect your website map view to streamline the user journey. Convert visitors to your site into customers for your product or service.

Niharika Sisodia Dec 18, 2018 3:30:14 PM
READ

How far can I travel in 15 minutes or 1 hour? This map shows you.

How far can I travel within a time limit? Make a map to show you where you can reach within a certain travel time. Change the mode of transport and time of day. Add up to three starting locations and filter the intersection between them.

Niharika Sisodia Nov 26, 2018 9:17:41 AM
READ

What is geocoding? Use geocoding to display postcodes on a map

What is geocoding and how does it work. Use a geocoder to convert place names and postcodes into coordinates. Display coordinates on a map. Use geocoding to improve routing and map display.

Niharika Sisodia Nov 22, 2018 9:26:41 AM
READ