What is GeoJSON?
GeoJSON is a specification for storing and representing geographic data in JSON format. If you have JSON data that contains latitude and longitude values, the data needs to be converted to GeoJSON format before you can view it on a map.
What is an isochrone?
An isochrone, in this context, is a shape that shows all locations that are reachable within a set travel time limit. For example, the image below shows all the locations you can reach within 45 minutes assuming you depart Times Square, Manhattan at 1pm on a weekday.
How do you create an isochrone?
In this blog, we use the TravelTime API to create an isochrone shape. The API’s TimeMap feature returns JSON response. We can convert JSON to GEOJSON using the steps below. Take a look at an exampleTimeMap response.
Example of an isochrone shape returned by the TravelTime API using TimeMap
The response is made up of:
This is the term to describe the makeup of the isochrone. The lat/long coordinates describe the linear ring of the isochrone. This defines the points that should be joined up to define the isochrone shape.
This is the term to describe the areas within the total isochrone shapes that aren’t reachable. The coordinates of the cut out are given to the user.
To get more information on how to create an isochrone using the TravelTime API take a look at thistutorial
Receiving a TravelTime TImeMap response as GeoJSON
Receiving data in GeoJSON format using TravelTimeAPI is made effortless. In order to do so, one has to specify the output GeoJSON format when creating the request. For this, we will be usingNode.js SDKlibrary. Additional details and general documentation can be foundhere.
The steps to getting GeoJSON response are:
- Provide TravelTime AccountApplication ID and Keys
- Provide parameters required to generate an isochrone
- Specify output type to GeoJSON - 'application/geo+json' as it can be seen on line 21
Viewing GeoJSON within an application
After the response has been received, it can be viewed using a number of applications.
GeoJSON is compatible with several mapping API’s, including:
- Open Layers
It is also compatible with other open source software, including: