What is a distance radius map?
You can create a map with distance radius by drawing a straight line from a central point to all possible points in a circle. Distance radius maps are useful for discovering points of interest in an area.
How do I make a distance radius map?
If you are not a developer, don’t worry. You don’t have to be able to code to draw a distance radius map. There are lots of free tools online that do the heavy lifting for you.The tool below can help you make radius distance maps in seconds, or use the code example below.
TravelTime have created a distance radius map tool that allows you to draw a radius map with distance, and to make isochrones using time.
- Enter the distance you would like the radius map to cover (in miles or km)
- Enter the central point you would like to start from (postcode or area)
- Click ‘GO’
To view travel times click ‘view reachable area by public transport’
Click ‘view reachable area by driving’
To edit the departure/arrival time, or create cycling, walking, driving and train maps use the TravelTime
You can also code radius distance maps, which allows you to integrate maps into your products and services. A radius distance map can be useful for data analysis and can enhance user experience. For more on radius maps take a look at our resource page.
How do I code a map with radius distance?
The code example below shows you how to code a 10 mile radius from The White House, Washington DC on a Leaflet map. This example creates a map like the one displayed above.
Step by step
Create boilerplate code on a map application, the example below uses Leaflet
However, currently this displays a blank page. To set up the map to be displayed on the page we should use a function like this:
To allow users to interact with the map, you will also need to use a geocoder, such as the free TravelTime API Geocoder. A geocoder turns location names and postcodes into coordinates to be displayed on a map. This means that users will be able to enter a distance and location and create their own radius distance maps.
Use a geocoder translate a location name into coordinates
First we need to define everything needed for the geocoding request. Usually the name of the location is taken from an input element on the page but for our example we will use a single constant.
Our geocoding api requires authentication in the header:
Now we can send the geocoding request:
Finally we get to actually showing the radius on the map. A radius is just a circle. We want to draw a radius of 10 miles.
Now let’s take a look at all of our code in one place:
How do I code a map with travel time distance?
You can also use an API to show where you can get within X minutes. The example below shows where you can reach in 30 minutes by public transport in London. Get API keys here and contact support with any questions.
Create travel time polygons and matrices with the TravelTime API