Today we’re announcing that we have added GeoJSON as a new supported response format for the time-map endpoint of the TravelTime API. The time-map endpoint lets you create isochrones, allowing you to display all locations that are reachable within a time limit on a map. You can use this to display isochrones within your web app or as part of your location analysis.
The time-map endpoint by default returns a response in JSON format, but this can now be changed to GeoJSON using the Accept header of a request. While the JSON format for multi-polygons is structured around ‘shells’ and ‘holes’, the GeoJSON format follows the more standardised form of polygons and holes.
Using this more standardised format makes it simpler to parse the response from the TravelTime API. This makes it more straightforward to display isochrones in a web app, such as a property portal or recruitment site, or to add them into desktop tools that accept GeoJSON as an input layer, such as Tableau.
Send a request using GeoJSON
To set the response type to GeoJSON, simply update the Accept header from application/json to application/geo+json
To send a test request using the GeoJSON format, make the following Curl request:
Note: you’ll need to enter your own Application ID and API Key in place of the placeholders
Example Use Cases
1. Displaying isochrones in your app or website
The GeoJSON format makes displaying isochrones in a web application much more straightforward.
Whereas previously the JSON response on shells and holes needed to be parsed to GeoJSON, with the GeoJSON response format, this whole process can be skipped.
Try this out by copying and pasting a GeoJSON response into this application. The response should immediately be displayed as an isochrone on the map, for example:
2. Loading layers into desktop GIS & analytics tools
GeoJSON is a common format for loading spatial files into desktop analytics applications like Tableau or desktop GIS tools such as QGIS and ArcGIS.
For example, we can save a time-map GeoJSON response as a .geojson file and add it straight into a Tableau Desktop worksheet without any configuration required:
Similarly, using QGIS we can simply drag and drop the .geojson file onto the map to display the isochrone:
We’re continuously striving to improve the performance and experience of our API, so you can integrate it into your application more easily. As part of this effort, we’ve added GeoJSON as a new accepted response format for the time-map endpoint of the TravelTime API.
This change to a more standard format makes interpreting the response significantly easier and makes it more straightforward to display an isochrone on a web page or add it into a desktop GIS tool.
To test the TravelTime API for your project, sign up for a free API key here.