traveltimeR
TravelTime SDK for R programming language
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Repository
TravelTime SDK for R programming language
Basic Info
- Host: GitHub
- Owner: traveltime-dev
- License: other
- Language: R
- Default Branch: master
- Homepage: https://docs.traveltime.com/
- Size: 109 KB
Statistics
- Stars: 8
- Watchers: 4
- Forks: 1
- Open Issues: 5
- Releases: 0
Metadata Files
README.md
Travel Time R SDK
Travel Time R SDK 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.
Installation
You can install Travel Time R SDK hosted on CRAN repository with the following command:
r
install.packages("traveltimeR")
System requirements
traveltimeR uses rprotobuf as a dependency. If your package installation fails, please make sure you have the system requirements covered for rprotobuf
Debian/Ubuntu
bash
sudo apt-get install protobuf-compiler libprotobuf-dev libprotoc-dev
MacOS
bash
brew install protobuf
There also exists similar commands on other distributions or operating systems.
Authentication
In order to authenticate with Travel Time API, you will have to supply the Application ID and API Key.
``` r library(traveltimeR)
store your credentials in an environment variable
Sys.setenv(TRAVELTIMEID = "YOURAPPID") Sys.setenv(TRAVELTIMEKEY = "YOURAPPKEY") ```
Usage
Isochrones (Time Map)
Given origin coordinates, find shapes of zones reachable within corresponding travel time. Find unions/intersections between different searches.
```r dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ")
departuresearch <- makesearch(id = "public transport from Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), departuretime = dateTime, traveltime = 900, transportation = list(type = "publictransport"), properties = list('isonly_walking'))
arrivalsearch <- makesearch(id = "public transport to Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), arrivaltime = dateTime, traveltime = 900, transportation = list(type = "public_transport"), range = list(enabled = TRUE, width = 3600))
result <- timemap( departuresearches = departuresearch, arrivalsearches = arrival_search )
print(result) ```
Isochrones (Time Map) Fast
A very fast version of Isochrone API. However, the request parameters are much more limited.
```r arrivalsearch <- makesearch(id = "public transport to Trafalgar Square", traveltime = 900, coords = list(lat = 51.507609, lng = -0.128315), arrivaltimeperiod = "weekdaymorning", transportation = list(type = "public_transport"))
result <- timemapfast( arrivalmanytoone = arrivalsearch )
print(result) ```
Distance Map
Given origin coordinates, find shapes of zones reachable within corresponding travel distance. Find unions/intersections between different searches. ```r dateTime <- strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ")
departuresearch <- makesearch(id = "driving from Trafalgar Square", departuretime = dateTime, traveldistance = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving"))
arrivalsearch <- makesearch(id = "driving to Trafalgar Square", arrivaltime = dateTime, traveldistance = 900, coords = list(lat = 51.507609, lng = -0.128315), transportation = list(type = "driving"), range = list(enabled = TRUE, width = 3600))
union <- makeunionintersect(id = "union of driving to and from Trafalgar Square", searchids = list('driving from Trafalgar Square', 'driving to Trafalgar Square')) intersection <- makeunionintersect(id = "intersection of driving to and from Trafalgar Square", searchids = list('driving from Trafalgar Square', 'driving to Trafalgar Square')) result <- distancemap( departuresearches = departuresearch, arrivalsearches = arrival_search, unions = union, intersections = intersection )
print(result) ```
Distance Matrix (Time Filter)
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.
Body attributes: * locations: Locations to use. Each location requires an id and lat/lng values. * departuresearches: Searches based on departure times. Leave departure location at no earlier than given time. You can define a maximum of 10 searches. * arrivalsearches: Searches based on arrival times. Arrive at destination location at no later than given time. You can define a maximum of 10 searches.
```r 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)
departuresearch <- makesearch(id = "departure search example", departurelocationid = "London center", arrivallocationids = list("Hyde Park", "ZSL London Zoo"), departuretime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, properties = list('traveltime'), transportation = list(type = "bus"), range = list(enabled = TRUE, width = 600, maxresults = 3))
arrivalsearch <- makesearch(id = "arrival search example", arrivallocationid = "London center", departurelocationids = list("Hyde Park", "ZSL London Zoo"), arrivaltime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, properties = list('traveltime', "distance", "distancebreakdown", "fares"), transportation = list(type = "publictransport"), range = list(enabled = TRUE, width = 600, maxresults = 3))
result <- timefilter( departuresearches = departuresearch, arrivalsearches = arrival_search, locations = locations )
print(result) ```
Routes
Returns routing information between source and destinations.
Body attributes: * locations: Locations to use. Each location requires an id and lat/lng values. * departuresearches: Searches based on departure times. Leave departure location at no earlier than given time. You can define a maximum of 10 searches. * arrivalsearches: Searches based on arrival times. Arrive at destination location at no later than given time. You can define a maximum of 10 searches.
```r locations <- c( makelocation( id = 'London center', coords = list(lat = 51.508930, lng = -0.131387)), makelocation( 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)) )
departuresearch <- makesearch(id = "departure search example", departurelocationid = "London center", arrivallocationids = list("Hyde Park", "ZSL London Zoo"), departuretime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), properties = list("traveltime", "distance", "route"), transportation = list(type = "driving"))
arrivalsearch <- makesearch(id = "arrival search example", arrivallocationid = "London center", departurelocationids = list("Hyde Park", "ZSL London Zoo"), arrivaltime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), properties = list('traveltime', "distance", "route", "fares"), transportation = list(type = "publictransport"), range = list(enabled = TRUE, width = 1800, maxresults = 1))
result <- routes( departuresearches = departuresearch, arrivalsearches = arrivalsearch, locations = locations )
print(result) ```
Time Filter (Fast)
A very fast version of time_filter().
However, the request parameters are much more limited.
```r locations <- c( makelocation('London center', list(lat = 51.508930, lng = -0.131387)), makelocation('Hyde Park', list(lat = 51.508824, lng = -0.167093)), make_location('ZSL London Zoo', list(lat = 51.536067, lng = -0.153596)) )
arrivalmanytoone <- makesearch(id = "arrive-at many-to-one search example", arrivallocationid = "London center", departurelocationids = list("Hyde Park", "ZSL London Zoo"), traveltime = 1900, arrivaltimeperiod = "weekdaymorning", properties = list('traveltime', "fares"), transportation = list(type = "publictransport"))
arrivalonetomany <- makesearch(id = "arrive-at one-to-many search example", departurelocationid = "London center", arrivallocationids = list("Hyde Park", "ZSL London Zoo"), traveltime = 1900, properties = list('traveltime', "fares"), arrivaltimeperiod = "weekdaymorning", transportation = list(type = "publictransport"))
result <- timefilterfast(locations, arrivalmanytoone, arrivalonetomany)
print(result) ```
Time Filter Fast (Proto)
A fast version of time filter communicating using protocol buffers.
Body attributes: * departureLat: Origin point latitude. * departureLng: Origin point longitude. * destinationCoordinates: Destination points. Cannot be more than 200,000. * transportation: Transportation type. * travelTime: Time limit. * country: Return the results that are within the specified country.
r
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
)
Time Filter (Postcode Districts)
Find reachable postcodes from origin (or to destination) and get statistics about such postcodes. Currently only supports United Kingdom.
```r departuresearch <- makesearch(id = "public transport from Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), departuretime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, transportation = list(type = "publictransport"), reachablepostcodesthreshold = 0.1, properties = list("coverage", "traveltimereachable", "traveltime_all"))
arrivalsearch <- makesearch(id = "public transport to Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), arrivaltime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, transportation = list(type = "publictransport"), reachablepostcodesthreshold = 0.1, properties = list("coverage", "traveltimereachable", "traveltime_all"))
result <- timefilterpostcodedistricts( departuresearches = departuresearch, arrivalsearches = arrival_search )
print(result) ```
Time Filter (Postcode Sectors)
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.
```r departuresearch <- makesearch(id = "public transport from Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), departuretime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, transportation = list(type = "publictransport"), reachablepostcodesthreshold = 0.1, properties = list("coverage", "traveltimereachable", "traveltime_all"))
arrivalsearch <- makesearch(id = "public transport to Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), arrivaltime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, transportation = list(type = "publictransport"), reachablepostcodesthreshold = 0.1, properties = list("coverage", "traveltimereachable", "traveltime_all"))
result <- timefilterpostcodesectors( departuresearches = departuresearch, arrivalsearches = arrival_search )
print(result) ```
Time Filter (Postcodes)
Find reachable postcodes from origin (or to destination) and get statistics about such postcodes. Currently only supports United Kingdom.
```r departuresearch <- makesearch(id = "public transport from Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), departuretime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, transportation = list(type = "publictransport"), properties = list('traveltime', 'distance'))
arrivalsearch <- makesearch(id = "public transport to Trafalgar Square", coords = list(lat = 51.507609, lng = -0.128315), arrivaltime = strftime(as.POSIXlt(Sys.time(), "UTC"), "%Y-%m-%dT%H:%M:%SZ"), traveltime = 1800, transportation = list(type = "publictransport"), properties = list('traveltime', 'distance'))
result <- timefilterpostcodes( departuresearches = departuresearch, arrivalsearches = arrivalsearch )
print(result) ```
Geocoding (Search)
Match a query string to geographic coordinates.
Function accepts the following parameters:
* 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 or countries. If no results are found it will return the country itself. Optional. Format:ISO 3166-1 alpha-2 or alpha-3.
* format.exclude.country - Format the name field of the response to a well formatted, human-readable address of the location. Experimental. Optional.
* format.name - 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.
r
geocoding('Parliament square')
Reverse Geocoding
Attempt to match a latitude, longitude pair to an address.
Function accepts the following parameters:
lat- Latitude of the point to reverse geocode.lng- lng Longitude of the point to reverse geocode.
r
geocoding_reverse(lat=51.507281, lng=-0.132120)
Map Info
Get information about currently supported countries.
r
map_info()
Supported Locations
Find out what points are supported by the api.
r
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))
Owner
- Name: TravelTime
- Login: traveltime-dev
- Kind: organization
- Email: support@traveltime.com
- Location: United Kingdom
- Website: https://traveltime.com/
- Twitter: TravelTimeAPI
- Repositories: 12
- Profile: https://github.com/traveltime-dev
TravelTime is an API that can calculate travel times by any transport mode to thousands of locations within milliseconds.
GitHub Events
Total
- Issues event: 1
- Delete event: 1
- Issue comment event: 5
- Push event: 10
- Pull request review event: 8
- Pull request review comment event: 2
- Pull request event: 5
- Create event: 3
Last Year
- Issues event: 1
- Delete event: 1
- Issue comment event: 5
- Push event: 10
- Pull request review event: 8
- Pull request review comment event: 2
- Pull request event: 5
- Create event: 3
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 15
- Total pull requests: 27
- Average time to close issues: 2 months
- Average time to close pull requests: 12 days
- Total issue authors: 9
- Total pull request authors: 8
- Average comments per issue: 0.4
- Average comments per pull request: 0.48
- Merged pull requests: 27
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 5
- Pull requests: 1
- Average time to close issues: about 1 month
- Average time to close pull requests: 22 days
- Issue authors: 4
- Pull request authors: 1
- Average comments per issue: 0.4
- Average comments per pull request: 5.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- EivydasKoc (5)
- bartosz-witkowski (2)
- arnasbr (2)
- HenrikBengtsson (1)
- Chalente (1)
- caleb-kwon (1)
- ktmorris (1)
- MockusTravelTime (1)
Pull Request Authors
- EivydasKoc (18)
- EdvinasJusis (5)
- arnasbr (3)
- MockusT (2)
- arthurgailes (2)
- MockusTravelTime (2)
- SimonasJa (1)
- s-Nick-s (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 333 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 5
- Total maintainers: 1
cran.r-project.org: traveltimeR
Interface to 'Travel Time' API
- Homepage: https://github.com/traveltime-dev/traveltime-sdk-r
- Documentation: http://cran.r-project.org/web/packages/traveltimeR/traveltimeR.pdf
- License: MIT + file LICENSE
-
Latest release: 1.3.1
published 11 months ago
Rankings
Maintainers (1)
Dependencies
- R >= 2.10 depends
- RProtoBuf * imports
- data.table * imports
- httr * imports
- jsonlite * imports