Title: | Interface to 'Travel Time' API |
---|---|
Description: | 'Travel Time' API <https://docs.traveltime.com/api/overview/introduction> helps users find locations by journey time rather than using ‘as the crow flies’ distance. Time-based searching gives users more opportunities for personalisation and delivers a more relevant search. |
Authors: | TravelTime [aut, cre] (https://github.com/traveltime-dev) |
Maintainer: | TravelTime <[email protected]> |
License: | MIT + file LICENSE |
Version: | 1.2.1 |
Built: | 2025-02-08 02:50:39 UTC |
Source: | https://github.com/traveltime-dev/traveltime-sdk-r |
Validates location coordinates
check_coords_for_error(coords)
check_coords_for_error(coords)
coords |
Location coordinates. Must use this format: list(lat = 0, lng = 0) |
TRUE if coords are valid, FALSE otherwise
Given origin coordinates, find shapes of zones reachable within corresponding travel distance. Find unions/intersections between different searches
distance_map( departure_searches = NULL, arrival_searches = NULL, unions = NULL, intersections = NULL, format = NULL )
distance_map( departure_searches = NULL, arrival_searches = NULL, unions = NULL, intersections = NULL, format = NULL )
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
unions |
One or more objects created by |
intersections |
One or more objects created by |
format |
distance-map response format. See https://docs.traveltime.com/api/reference/distance-map#Response-Body for details. |
See https://docs.traveltime.com/api/reference/distance-map/ for details
API response parsed as a list and as a raw json
## Not run: dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ") departure_search <- make_search(id = "driving from Trafalgar Square", departure_time = dateTime, travel_distance = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving")) arrival_search <- make_search(id = "driving to Trafalgar Square", arrival_time = dateTime, travel_distance = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving"), range = list(enabled = TRUE, width = 3600)) union <- make_union_intersect(id = "union of driving to and from Trafalgar Square", search_ids = list('driving from Trafalgar Square', 'driving to Trafalgar Square')) intersection <- make_union_intersect(id = "intersection of driving to and from Trafalgar Square", search_ids = list('driving from Trafalgar Square', 'driving to Trafalgar Square')) result <- distance_map( departure_searches = departure_search, arrival_searches = arrival_search, unions = union, intersections = intersection ) ## End(Not run)
## Not run: dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ") departure_search <- make_search(id = "driving from Trafalgar Square", departure_time = dateTime, travel_distance = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving")) arrival_search <- make_search(id = "driving to Trafalgar Square", arrival_time = dateTime, travel_distance = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving"), range = list(enabled = TRUE, width = 3600)) union <- make_union_intersect(id = "union of driving to and from Trafalgar Square", search_ids = list('driving from Trafalgar Square', 'driving to Trafalgar Square')) intersection <- make_union_intersect(id = "intersection of driving to and from Trafalgar Square", search_ids = list('driving from Trafalgar Square', 'driving to Trafalgar Square')) result <- distance_map( departure_searches = departure_search, arrival_searches = arrival_search, unions = union, intersections = intersection ) ## End(Not run)
Match a query string to geographic coordinates.
geocoding( query, within.country = NA, format.name = NA, format.exclude.country = NA, bounds = NA )
geocoding( query, within.country = NA, format.name = NA, format.exclude.country = NA, bounds = NA )
query |
A query to geocode. Can be an address, a postcode or a venue. |
within.country |
Only return the results that are within the specified country. If no results are found it will return the country itself. Optional. Format:ISO 3166-1 alpha-2 or alpha-3 |
format.name |
Format the name field of the response to a well formatted, human-readable address of the location. Experimental. Optional. |
format.exclude.country |
Exclude the country from the formatted name field (used only if format.name is equal true). Optional. |
bounds |
Used to limit the results to a bounding box. Expecting a character vector with four floats, marking a south-east and north-west corners of a rectangle: min-latitude,min-longitude,max-latitude,max-longitude. e.g. bounds for Scandinavia c(54.16243,4.04297,71.18316,31.81641). Optional. |
See https://docs.traveltime.com/api/reference/geocoding-search/ for details
API response parsed as list and as a raw json
## Not run: geocoding('Parliament square') ## End(Not run)
## Not run: geocoding('Parliament square') ## End(Not run)
Attempt to match a latitude, longitude pair to an address.
geocoding_reverse(lat, lng)
geocoding_reverse(lat, lng)
lat |
Latitude of the point to reverse geocode. |
lng |
Longitude of the point to reverse geocode. |
See https://docs.traveltime.com/api/reference/geocoding-reverse/ for details
API response parsed as list and as a raw json
## Not run: geocoding_reverse(lat=51.507281, lng=-0.132120) ## End(Not run)
## Not run: geocoding_reverse(lat=51.507281, lng=-0.132120) ## End(Not run)
Define your locations to use later in departure_searches or arrival_searches.
make_location(id, coords)
make_location(id, coords)
id |
You will have to reference this id in your searches. It will also be used in the response body. MUST be unique among all locations. |
coords |
Location coordinates. Must use this format: list(lat = 0, lng = 0) |
See https://docs.traveltime.com/api/reference/distance-matrix for details
A data.frame wrapped in a list. It is constructed in a way that allows jsonlite::toJSON to correctly transform it into a valid request body
See time_filter
for usage examples
Searches based on departure or arrival times. Departure: Leave departure location at no earlier than given time. You can define a maximum of 10 searches Arrival: Arrive at destination location at no later than given time. You can define a maximum of 10 searches
make_search( id, travel_time = NA, coords = NA, departure_time = NA, arrival_time = NA, transportation = list(type = "driving"), ... )
make_search( id, travel_time = NA, coords = NA, departure_time = NA, arrival_time = NA, transportation = list(type = "driving"), ... )
id |
Used to identify this specific search in the results array. MUST be unique among all searches. |
travel_time |
Travel time in seconds. Maximum value is 14400 (4 hours) |
coords |
The coordinates of the location we should start the search from. Must use this format: list(lat = 0, lng = 0) |
departure_time |
Date in extended ISO-8601 format |
arrival_time |
Date in extended ISO-8601 format |
transportation |
Transportation mode and related parameters. |
... |
Any additional parameters to pass. Some functions require extra parameters to work. Check their API documentation for details. |
A data.frame wrapped in a list. It is constructed in a way that allows jsonlite::toJSON to correctly transform it into a valid request body
See time_map
for usage examples
Allows you to define unions or intersections of shapes that are results of previously defined searches. You can define a maximum of 10 unions/intersections
make_union_intersect(id, search_ids)
make_union_intersect(id, search_ids)
id |
Used to identify this specific search in the results array. MUST be unique among all searches. |
search_ids |
An unnamed list of search ids which results will formulate this union. |
See https://docs.traveltime.com/api/reference/isochrones for details
A data.frame wrapped in a list. It is constructed in a way that allows jsonlite::toJSON to correctly transform it into a valid request body
See time_map
for usage examples
Returns information about currently supported countries.
map_info()
map_info()
See https://docs.traveltime.com/api/reference/map-info/ for details
API response parsed as list and as a raw json
## Not run: map_info() ## End(Not run)
## Not run: map_info() ## End(Not run)
Returns routing information between source and destinations.
routes(locations, departure_searches = NULL, arrival_searches = NULL)
routes(locations, departure_searches = NULL, arrival_searches = NULL)
locations |
One or more objects created by |
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
See https://docs.traveltime.com/api/reference/routes/ for details
API response parsed as a list and as a raw json
## Not run: locations <- c( make_location( id = 'London center', coords = list(lat = 51.508930, lng = -0.131387)), make_location( id = 'Hyde Park', coords = list(lat = 51.508824, lng = -0.167093)), make_location( id = 'ZSL London Zoo', coords = list(lat = 51.536067, lng = -0.153596)) ) departure_search <- make_search(id = "departure search example", departure_location_id = "London center", arrival_location_ids = list("Hyde Park", "ZSL London Zoo"), departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), transportation = list(type = "driving"), properties = list("travel_time", "distance", "route")) arrival_search <- make_search(id = "arrival search example", arrival_location_id = "London center", departure_location_ids = list("Hyde Park", "ZSL London Zoo"), arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), transportation = list(type = "public_transport"), properties = list('travel_time', "distance", "route", "fares"), range = list(enabled = TRUE, width = 1800, max_results = 1)) result <- routes( departure_searches = departure_search, arrival_searches = arrival_search, locations = locations ) ## End(Not run)
## Not run: locations <- c( make_location( id = 'London center', coords = list(lat = 51.508930, lng = -0.131387)), make_location( id = 'Hyde Park', coords = list(lat = 51.508824, lng = -0.167093)), make_location( id = 'ZSL London Zoo', coords = list(lat = 51.536067, lng = -0.153596)) ) departure_search <- make_search(id = "departure search example", departure_location_id = "London center", arrival_location_ids = list("Hyde Park", "ZSL London Zoo"), departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), transportation = list(type = "driving"), properties = list("travel_time", "distance", "route")) arrival_search <- make_search(id = "arrival search example", arrival_location_id = "London center", departure_location_ids = list("Hyde Park", "ZSL London Zoo"), arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), transportation = list(type = "public_transport"), properties = list('travel_time', "distance", "route", "fares"), range = list(enabled = TRUE, width = 1800, max_results = 1)) result <- routes( departure_searches = departure_search, arrival_searches = arrival_search, locations = locations ) ## End(Not run)
Find out what points are supported by the api.
The returned map name for a point can be used to determine what features are supported.
See also the map_info
.
supported_locations(locations)
supported_locations(locations)
locations |
One or more objects created by |
See https://docs.traveltime.com/api/reference/supported-locations/ for details
API response parsed as list and as a raw json
## Not run: locationsDF <- data.frame( id = c('Kaunas', 'London', 'Bangkok', 'Lisbon'), lat = c(54.900008, 51.506756, 13.761866, 38.721869), lng = c(23.957734, -0.128050, 100.544818, -9.138549) ) locations <- apply(locationsDF, 1, function(x) make_location(id = x['id'], coords = list(lat = as.numeric(x["lat"]), lng = as.numeric(x["lng"])))) supported_locations(unlist(locations, recursive = FALSE)) ## End(Not run)
## Not run: locationsDF <- data.frame( id = c('Kaunas', 'London', 'Bangkok', 'Lisbon'), lat = c(54.900008, 51.506756, 13.761866, 38.721869), lng = c(23.957734, -0.128050, 100.544818, -9.138549) ) locations <- apply(locationsDF, 1, function(x) make_location(id = x['id'], coords = list(lat = as.numeric(x["lat"]), lng = as.numeric(x["lng"])))) supported_locations(unlist(locations, recursive = FALSE)) ## End(Not run)
Given origin and destination points filter out points that cannot be reached within specified time limit. Find out travel times, distances and costs between an origin and up to 2,000 destination points.
time_filter(locations, departure_searches = NULL, arrival_searches = NULL)
time_filter(locations, departure_searches = NULL, arrival_searches = NULL)
locations |
One or more objects created by |
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
See https://docs.traveltime.com/api/reference/travel-time-distance-matrix/ for details
API response parsed as a list and as a raw json
## Not run: locationsDF <- data.frame( id = c('London center', 'Hyde Park', 'ZSL London Zoo'), lat = c(51.508930, 51.508824, 51.536067), lng = c(-0.131387, -0.167093, -0.153596) ) locations <- apply(locationsDF, 1, function(x) make_location(id = x['id'], coords = list(lat = as.numeric(x["lat"]), lng = as.numeric(x["lng"])))) locations <- unlist(locations, recursive = FALSE) departure_search <- make_search(id = "forward search example", departure_location_id = "London center", arrival_location_ids = list("Hyde Park", "ZSL London Zoo"), departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, transportation = list(type = "bus"), properties = list('travel_time'), range = list(enabled = TRUE, width = 600, max_results = 3)) arrival_search <- make_search(id = "backward search example", arrival_location_id = "London center", departure_location_ids = list("Hyde Park", "ZSL London Zoo"), arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, transportation = list(type = "public_transport"), properties = list('travel_time', "distance", "distance_breakdown", "fares"), range = list(enabled = TRUE, width = 600, max_results = 3)) result <- time_filter( departure_searches = departure_search, arrival_searches = arrival_search, locations = locations ) ## End(Not run)
## Not run: locationsDF <- data.frame( id = c('London center', 'Hyde Park', 'ZSL London Zoo'), lat = c(51.508930, 51.508824, 51.536067), lng = c(-0.131387, -0.167093, -0.153596) ) locations <- apply(locationsDF, 1, function(x) make_location(id = x['id'], coords = list(lat = as.numeric(x["lat"]), lng = as.numeric(x["lng"])))) locations <- unlist(locations, recursive = FALSE) departure_search <- make_search(id = "forward search example", departure_location_id = "London center", arrival_location_ids = list("Hyde Park", "ZSL London Zoo"), departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, transportation = list(type = "bus"), properties = list('travel_time'), range = list(enabled = TRUE, width = 600, max_results = 3)) arrival_search <- make_search(id = "backward search example", arrival_location_id = "London center", departure_location_ids = list("Hyde Park", "ZSL London Zoo"), arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, transportation = list(type = "public_transport"), properties = list('travel_time', "distance", "distance_breakdown", "fares"), range = list(enabled = TRUE, width = 600, max_results = 3)) result <- time_filter( departure_searches = departure_search, arrival_searches = arrival_search, locations = locations ) ## End(Not run)
A very fast version of time_filter
. However, the request parameters are much more limited.
Currently only supports UK and Ireland.
time_filter_fast( locations, arrival_many_to_one = NULL, arrival_one_to_many = NULL )
time_filter_fast( locations, arrival_many_to_one = NULL, arrival_one_to_many = NULL )
locations |
One or more objects created by |
arrival_many_to_one |
One or more objects created by |
arrival_one_to_many |
One or more objects created by |
See https://docs.traveltime.com/api/reference/time-filter-fast/ for details
API response parsed as a list and as a raw json
## Not run: locations <- c( make_location( id = 'London center', coords = list(lat = 51.508930, lng = -0.131387)), make_location( id = 'Hyde Park', coords = list(lat = 51.508824, lng = -0.167093)), make_location( id = 'ZSL London Zoo', coords = list(lat = 51.536067, lng = -0.153596)) ) arrival_many_to_one <- make_search(id = "arrive-at many-to-one search example", arrival_location_id = "London center", departure_location_ids = list("Hyde Park", "ZSL London Zoo"), travel_time = 1900, transportation = list(type = "public_transport"), properties = list('travel_time', "fares"), arrival_time_period = "weekday_morning") arrival_one_to_many <- make_search(id = "arrive-at one-to-many search example", departure_location_id = "London center", arrival_location_ids = list("Hyde Park", "ZSL London Zoo"), travel_time = 1900, transportation = list(type = "public_transport"), properties = list('travel_time', "fares"), arrival_time_period = "weekday_morning") result <- time_filter_fast(locations, arrival_many_to_one, arrival_one_to_many) ## End(Not run)
## Not run: locations <- c( make_location( id = 'London center', coords = list(lat = 51.508930, lng = -0.131387)), make_location( id = 'Hyde Park', coords = list(lat = 51.508824, lng = -0.167093)), make_location( id = 'ZSL London Zoo', coords = list(lat = 51.536067, lng = -0.153596)) ) arrival_many_to_one <- make_search(id = "arrive-at many-to-one search example", arrival_location_id = "London center", departure_location_ids = list("Hyde Park", "ZSL London Zoo"), travel_time = 1900, transportation = list(type = "public_transport"), properties = list('travel_time', "fares"), arrival_time_period = "weekday_morning") arrival_one_to_many <- make_search(id = "arrive-at one-to-many search example", departure_location_id = "London center", arrival_location_ids = list("Hyde Park", "ZSL London Zoo"), travel_time = 1900, transportation = list(type = "public_transport"), properties = list('travel_time', "fares"), arrival_time_period = "weekday_morning") result <- time_filter_fast(locations, arrival_many_to_one, arrival_one_to_many) ## End(Not run)
The Travel Time Matrix (Fast) endpoint is available with even higher performance through a version using Protocol Buffers. The endpoint takes as inputs a single origin location, multiple destination locations, a mode of transport, and a maximum travel time. The endpoint returns the travel times to each destination location, so long as it is within the maximum travel time.
time_filter_fast_proto( departureLat, departureLng, country = c("uk", "ireland"), travelTime, destinationCoordinates, transportation = names(protoTransport), useDistance = FALSE )
time_filter_fast_proto( departureLat, departureLng, country = c("uk", "ireland"), travelTime, destinationCoordinates, transportation = names(protoTransport), useDistance = FALSE )
departureLat |
origin latitude |
departureLng |
origin longitude |
country |
Origin country. Only UK and Ireland are supported. |
travelTime |
Maximum journey time (in seconds). |
destinationCoordinates |
data.frame with pairs of coordinates. Coordinates columns must be named 'lat' and 'lng' |
transportation |
One of supported transportation methods: 'pt', 'driving+ferry', 'cycling+ferry', 'walking+ferry'. |
useDistance |
return distance information |
See https://docs.traveltime.com/api/start/travel-time-distance-matrix-proto for details
API response parsed as a list and as a raw json
## Not run: time_filter_fast_proto( departureLat = 51.508930, departureLng = -0.131387, destinationCoordinates = data.frame( lat = c(51.508824, 51.536067), lng = c(-0.167093, -0.153596) ), transportation = 'driving+ferry', travelTime = 7200, country = "uk", useDistance = FALSE ) ## End(Not run)
## Not run: time_filter_fast_proto( departureLat = 51.508930, departureLng = -0.131387, destinationCoordinates = data.frame( lat = c(51.508824, 51.536067), lng = c(-0.167093, -0.153596) ), transportation = 'driving+ferry', travelTime = 7200, country = "uk", useDistance = FALSE ) ## End(Not run)
Find districts that have a certain coverage from origin (or to destination) and get statistics about postcodes within such districts. Currently only supports United Kingdom.
time_filter_postcode_districts( departure_searches = NULL, arrival_searches = NULL )
time_filter_postcode_districts( departure_searches = NULL, arrival_searches = NULL )
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
See https://docs.traveltime.com/api/reference/postcode-district-filter/ for details
API response parsed as a list and as a raw json
## Not run: departure_search <- make_search(id = "public transport from Trafalgar Square", departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) result <- time_filter_postcode_districts( departure_searches = departure_search, arrival_searches = arrival_search ) ## End(Not run)
## Not run: departure_search <- make_search(id = "public transport from Trafalgar Square", departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) result <- time_filter_postcode_districts( departure_searches = departure_search, arrival_searches = arrival_search ) ## End(Not run)
Find sectors that have a certain coverage from origin (or to destination) and get statistics about postcodes within such sectors. Currently only supports United Kingdom.
time_filter_postcode_sectors( departure_searches = NULL, arrival_searches = NULL )
time_filter_postcode_sectors( departure_searches = NULL, arrival_searches = NULL )
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
See https://docs.traveltime.com/api/reference/postcode-sector-filter/ for details
API response parsed as a list and as a raw json
## Not run: departure_search <- make_search(id = "public transport from Trafalgar Square", departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) result <- time_filter_postcode_sectors( departure_searches = departure_search, arrival_searches = arrival_search ) ## End(Not run)
## Not run: departure_search <- make_search(id = "public transport from Trafalgar Square", departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), reachable_postcodes_threshold = 0.1, properties = list("coverage", "travel_time_reachable", "travel_time_all")) result <- time_filter_postcode_sectors( departure_searches = departure_search, arrival_searches = arrival_search ) ## End(Not run)
Find reachable postcodes from origin (or to destination) and get statistics about such postcodes. Currently only supports United Kingdom.
time_filter_postcodes(departure_searches = NULL, arrival_searches = NULL)
time_filter_postcodes(departure_searches = NULL, arrival_searches = NULL)
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
See https://docs.traveltime.com/api/reference/postcode-search/ for details
API response parsed as a list and as a raw json
## Not run: departure_search <- make_search(id = "public transport from Trafalgar Square", departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), properties = list('travel_time', 'distance')) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), properties = list('travel_time', 'distance')) result <- time_filter_postcodes( departure_searches = departure_search, arrival_searches = arrival_search ) ## End(Not run)
## Not run: departure_search <- make_search(id = "public transport from Trafalgar Square", departure_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), properties = list('travel_time', 'distance')) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), travel_time = 1800, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), properties = list('travel_time', 'distance')) result <- time_filter_postcodes( departure_searches = departure_search, arrival_searches = arrival_search ) ## End(Not run)
Given origin coordinates, find shapes of zones reachable within corresponding travel time. Find unions/intersections between different searches
time_map( departure_searches = NULL, arrival_searches = NULL, unions = NULL, intersections = NULL, format = NULL )
time_map( departure_searches = NULL, arrival_searches = NULL, unions = NULL, intersections = NULL, format = NULL )
departure_searches |
One or more objects created by |
arrival_searches |
One or more objects created by |
unions |
One or more objects created by |
intersections |
One or more objects created by |
format |
time-map response format. See https://docs.traveltime.com/api/reference/isochrones#Response-Body for details. |
See https://docs.traveltime.com/api/reference/isochrones/ for details
API response parsed as a list and as a raw json
## Not run: dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ") departure_search1 <- make_search(id = "public transport from Trafalgar Square", departure_time = dateTime, travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), properties = list('is_only_walking')) departure_search2 <- make_search(id = "driving from Trafalgar Square", departure_time = dateTime, travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving")) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = dateTime, travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), range = list(enabled = TRUE, width = 3600)) union <- make_union_intersect(id = "union of driving and public transport", search_ids = list('driving from Trafalgar Square', 'public transport from Trafalgar Square')) intersection <- make_union_intersect(id = "intersection of driving and public transport", search_ids = list('driving from Trafalgar Square', 'public transport from Trafalgar Square')) result <- time_map( departure_searches = c(departure_search1, departure_search2), arrival_searches = arrival_search, unions = union, intersections = intersection ) ## End(Not run)
## Not run: dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ") departure_search1 <- make_search(id = "public transport from Trafalgar Square", departure_time = dateTime, travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), properties = list('is_only_walking')) departure_search2 <- make_search(id = "driving from Trafalgar Square", departure_time = dateTime, travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving")) arrival_search <- make_search(id = "public transport to Trafalgar Square", arrival_time = dateTime, travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "public_transport"), range = list(enabled = TRUE, width = 3600)) union <- make_union_intersect(id = "union of driving and public transport", search_ids = list('driving from Trafalgar Square', 'public transport from Trafalgar Square')) intersection <- make_union_intersect(id = "intersection of driving and public transport", search_ids = list('driving from Trafalgar Square', 'public transport from Trafalgar Square')) result <- time_map( departure_searches = c(departure_search1, departure_search2), arrival_searches = arrival_search, unions = union, intersections = intersection ) ## End(Not run)
A very fast version of Isochrone API. However, the request parameters are much more limited.
time_map_fast( arrival_many_to_one = NULL, arrival_one_to_many = NULL, format = NULL )
time_map_fast( arrival_many_to_one = NULL, arrival_one_to_many = NULL, format = NULL )
arrival_many_to_one |
One or more objects created by |
arrival_one_to_many |
One or more objects created by |
format |
time-map response format. See https://docs.traveltime.com/api/reference/isochrones-fast#Response-Body for details. |
See https://docs.traveltime.com/api/reference/isochrones-fast/ for details
API response parsed as a list and as a raw json
## Not run: arrival_search <- make_search(id = "public transport to Trafalgar Square", travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), arrival_time_period = "weekday_morning", transportation = list(type = "public_transport")) result <- time_map_fast( arrival_many_to_one = arrival_search ) ## End(Not run)
## Not run: arrival_search <- make_search(id = "public transport to Trafalgar Square", travel_time = 900, coords = list(lat = 51.507609, lng = -0.128315), arrival_time_period = "weekday_morning", transportation = list(type = "public_transport")) result <- time_map_fast( arrival_many_to_one = arrival_search ) ## End(Not run)