knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

This package allows to retrieve isochrones for traveltime-maps from the Traveltime Platform API directly from R. The isochrones are stored as sf-objects, ready for visualization or further processing. The isochrones display how far you can travel from a certain location within a given timeframe.

GET an API-KEY here: http://docs.traveltimeplatform.com/overview/getting-keys/

For non-commercial use the usage of the API is free up to 10’000 queries a month (max 30 queries per min). For commercial use (e.g. to integrate the API into a website) a license is needed.

library(traveltime)
#devtools::install_github("reidfalconer/traveltime")

# load packages
if (!require("pacman")) install.packages("pacman")
pacman::p_load(dplyr, purrr, sf, mapview, traveltime, magrittr)

You can retrieve the isochrones with the traveltime_map function. Find a list of supported countries here: http://docs.traveltimeplatform.com/overview/supported-countries/

Querying the Traveltime-API with traveltime_map

# retrieve data via request 

# The following transport modes are supported:

# "cycling"", "cycling_ferry", "driving", "driving+train", "driving_ferry", 
# "public_transport", "walking", "walking+coach", "walking_bus", 
# "walking_ferry" or "walking_train".

# How far can you go by public transport from the Barcelona Graduate School 
# of Economics (BGSE) within 30 minutes?
traveltime30 <- traveltime_map(appId="YourAppId",
               apiKey="YourApiKey",
               location=c(41.38926,2.190681),
               traveltime=1800,
               type="public_transport",
               departure="2019-06-15T08:00:00+01:00")

# take a glimpse at the data
mapview::mapview(traveltime30)
# and within 60 minutes?
traveltime60 <- traveltime_map(appId="YourAppId",
               apiKey="YourApiKey",
               location=c(41.38926,2.190681),
               traveltime=3600,
               type="public_transport",
               departure="2019-06-15T08:00:00+01:00")

# take a glimpse at the data
mapview::mapview(traveltime60)
# You can switch to arrival search (from how far is a location 
# reachable within x min?) just by using the 'arrival' argument 
# instead of 'departure'.

traveltime30_arrival <- traveltime_map(appId="YourAppId",
               apiKey="YourApiKey",
               location=c(41.38926,2.190681),
               traveltime=1800,
               type="public_transport",
               arrival="2019-06-15T08:00:00Z")

mapview::mapview(traveltime30_arrival)


reidfalconer/traveltime documentation built on June 23, 2019, 3:44 a.m.