Title: | Walk Score and Transit Score API |
---|---|
Description: | A collection of functions to perform the Application Programming Interface (API) calls associated with the Walk Score website (www.walkscore.com) within the R environment. These functions can be used to query the Walk Score and Transit Score database for a wide variety of information using R scripts. This package includes the simple Walk Score and Transit Score API calls, which return the scores associated with an input location, as well as calls which return some data used to calculate the scores. These functions are especially useful for mass data collection and gathering Walk Score and Transit Score values for large lists of locations. |
Authors: | John Whalen |
Maintainer: | John Whalen <[email protected]> |
License: | GPL-2 |
Version: | 1.2 |
Built: | 2024-11-15 03:50:29 UTC |
Source: | https://github.com/cran/walkscoreAPI |
A collection of functions to perform the Application Programming Interface (API) calls associated with the Walk Score website (www.walkscore.com) within the R environment. These functions can be used to query the Walk Score and Transit Score database for a wide variety of information using R scripts. This package includes the simple Walk Score and Transit Score API calls, which return the scores associated with an input location, as well as calls which return some data used to calculate the scores. These functions are especially useful for mass data collection and gathering Walk Score and Transit Score values for large lists of locations.
Package: | walkscoreAPI |
Type: | Package |
Version: | 1.2 |
Date: | 2012-01-04 |
License: | GPL-2 |
LazyLoad: | yes |
Every function in this package requires the use of a Walk Score API key number, enetered as a parameter. The key is free to obtain with limited use, and can be requested here: http://www.walkscore.com/professional/api.php. The easiest way to enter the key is to store the string as a variable and entering that variable as a parameter for the function calls.
John Whalen
Maintainer: <[email protected]>
Visit www.walkscore.com for information on Walk Score and to obtain an API key
## Not run: test <- geoloc("350 5th Avenue New York NY", "Google API key") getWS(test$coordinates[1],test$coordinates[2], "Walk Score API key") getTS(test$coordinates[1],test$coordinates[2],"New York","NY","Walk Score API key") ## End(Not run)
## Not run: test <- geoloc("350 5th Avenue New York NY", "Google API key") getWS(test$coordinates[1],test$coordinates[2], "Walk Score API key") getTS(test$coordinates[1],test$coordinates[2],"New York","NY","Walk Score API key") ## End(Not run)
A function to check if a city of interest is among the cities supported by the Transit Score.
checkTSsupport(city, state, key)
checkTSsupport(city, state, key)
city |
name of city of interest (string) |
state |
postal abbreviation of city's state (string) |
key |
your Walk Score API key (string) |
Transit Score only works in select cities.
TRUE if city is supported, FALSE otherwise
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: checkTSsupport("Buffalo","NY","your key") ## End(Not run)
## Not run: checkTSsupport("Buffalo","NY","your key") ## End(Not run)
A function to perform the Google Geolocation API call, and return the longitude and latitude coordinates of the query location.
geoloc(address, apikey)
geoloc(address, apikey)
address |
query address (string). Do not use commas, and zip codes are not required, e.g. "1600 Pennsylvania Ave Washington DC". |
apikey |
your Google API key (string) |
Use of this function requires a Google API key, which is different from the Walk Score API key. Get one here: http://code.google.com/apis/maps/signup.html
Returns an object of class GoogleGeoloc
, basically a list of the following elements:
coordinates |
A vector of two numbers, the first representing the longitude and the second representing the latitude. |
accuracy |
Accuracy rating of geolocation. |
city |
City containing the requested address |
state |
State containing the requested address |
country |
Country containing the requested address |
For description of Google Geolocation see here: http://code.google.com/apis/gears/api_geolocation.html
John Whalen
http://code.google.com/apis/gears/api_geolocation.html
## Not run: geoloc("350 5th Avenue New York NY","your Google API key") ## End(Not run)
## Not run: geoloc("350 5th Avenue New York NY","your Google API key") ## End(Not run)
A function to perform the basic Transit Score API call.
getTS(x, y, city, state, key)
getTS(x, y, city, state, key)
x |
longitude of query location (numeric) |
y |
latitude of query location (numeric) |
city |
name of core city where the query location is located (string) |
state |
postal abriviation of query location's state (string) |
key |
your Walk Score API key (string) |
The Transit Score API call only works in supported cities. Use the functions "checkTSsupport" or "getTScities" to check for support in the city of interest. Also note that calls should use the core city name, even when the query location is technically in a suburb of the core city.
Returns an object of class TransitScore
, basically a list of the following elements:
transitscore |
Transit Score of query location. |
url |
Link to Walk Score page associated with your query. |
description |
Qualitative description of query location regarding transit. |
summary |
Summary of nearby routes and stops. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: getTS(-73.98496,40.74807,"New York","NY","your key") ## End(Not run)
## Not run: getTS(-73.98496,40.74807,"New York","NY","your key") ## End(Not run)
A function to list cities supported by Transit Score.
getTScities(key)
getTScities(key)
key |
Your Walk Score API key (string) |
Prints a list of all cities currently supported by Transit Score.
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: getTScities("your key") ## End(Not run)
## Not run: getTScities("your key") ## End(Not run)
A function to perform the basic Walk Score API call.
getWS(x, y, key)
getWS(x, y, key)
x |
longitude of query location (numeric) |
y |
latitude of query location (numeric) |
key |
your Walk Score API key (string), see Details below |
Note that the call uses longitude and latitude coordintes and not addresses like the website interface. It is strongly recomended that Google Geolocation is used to convert addresses to coordinates because this is the method used by the Walk Score website, and will result in the same Walk Score as entering the address into the website interface. The function "geoloc" in this package is a tool for using the Google Geolocation API.
Otherwise Returns an object of class WalkScore
, basically a list of the following elements:
status |
Status code of the request. Status of 1 indicates a successful call. See the Walk Score API page for interpretation of other codes. |
walkscore |
Walk Score of query location. |
description |
Qualitative description of location. |
updated |
Date and time of most recent update to this location's Walk Score. |
snappedLong |
grid point longitude to which the input was snapped to. |
snappedLat |
grid point latitude to which the input was snapped to. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/api.php
## Not run: getWS(-73.98496,40.74807,"your key") ## End(Not run)
## Not run: getWS(-73.98496,40.74807,"your key") ## End(Not run)
A function to perform the Network Search API call.
networkSearch(x, y, key)
networkSearch(x, y, key)
x |
longitude of query location (numeric) |
y |
latitude of query location (numeric) |
key |
your Walk Score API key (string) |
gives information about all routes and all stops within a mile radius of a query location. This function returns a very data-rich object with details on every stop and every route included in this radius.
Returns an object of class NetworkSearch
, which has two elements: first is $routelist, which is a list of objects of class Route
, and second is $stoplist, which is a list of objects of class Stop
.
routelist |
List of routeID, route name, route catagory, maintaining agency, agency website, and stops served by the route. |
stoplist |
List of stopID, stop name, stop latitude, stop longitude, and a list of routes which use the stop. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: networkSearch(-73.98496,40.74807,"your key") ## End(Not run)
## Not run: networkSearch(-73.98496,40.74807,"your key") ## End(Not run)
A function to perform the Route Details API call, which provides additional information about a particular route.
routeDetails(routeid, key)
routeDetails(routeid, key)
routeid |
Route ID number for the route of interest (string) |
key |
your Walk Score API key (string) |
Route ID is a unique string of characters used to identfy routes. They can be obtained through the search functions provided in this library.
Returns an object of class RouteDetails
, basically a list of the following elements:
routeID |
The route ID of the route of intrest (same as input ID) |
routeName |
Name of the route of interest |
routeCatagory |
Mode of transportation associated with this route |
agency |
Transit agency associated with this route |
agencyURL |
Agency website |
routeGeometry |
Coordinates of route linestring, used for mapping the route. |
stopList |
List of stop ID's served by this route. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: routeDetails("r415","your key") ## End(Not run)
## Not run: routeDetails("r415","your key") ## End(Not run)
A function to perform the Stop Details API call, which provides additional information about a transit stop of interest.
stopDetails(stopid, key)
stopDetails(stopid, key)
stopid |
The stop ID of the stop of interest. (string) |
key |
your Walk Score API key. (string) |
Stop ID is a unique string of characters used to identfy stops. They can be obtained through the search functions provided in this library.
Returns an object of class StopDetails
, basically a list of the following elements:
stopID |
ID of the stop of interest (same as input ID) |
stopName |
Name of stop of interest. |
stopLong |
Longitude of stop of interest. |
stopLat |
Latitude of stop of interest. |
routeList |
List of route ID's which serve the stop of interest. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: stopDetails("s13993", "your key") ## End(Not run)
## Not run: stopDetails("s13993", "your key") ## End(Not run)
A function to preform the Stop Search API Call.
stopSearch(x, y, key)
stopSearch(x, y, key)
x |
longitude of query location (numeric) |
y |
latitude of query location (numeric) |
key |
your Walk Score API key (string) |
The Stop Search API Call returns the sixteen closest stops to a query location which service unique routes.
Returns a list of objects of class "Stop2", which are basically lists with the following elements:
stopID |
A unique ID for the particular stop, which can be used to get additional info about that stop. |
stopName |
Name of the particular stop. |
stopDistance |
Distance to the query location, in miles. |
stopLong |
Longitude of the particular stop. |
stopLat |
Latitude of the particular stop. |
routeDetails |
Object of class "RouteDetails", which lists the route id, name, catagory, and agency of the orute served at the stop. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: stopSearch(-73.98496,40.74807,"your key") ## End(Not run)
## Not run: stopSearch(-73.98496,40.74807,"your key") ## End(Not run)
A function to preform the "Walking Distance" API Call.
walkshed(x, y, key)
walkshed(x, y, key)
x |
longitude of query location (numeric) |
y |
latitude of query location (numeric) |
key |
your Walk Score API key (string) |
The "Walking Distance" API call returns the geometry of a polygon which bounds network walking distance from the given origin point.
Returns an object of class "Walkshed", which is basically a list with the following elements:
status |
A code which tells the status of the request. The table of status codes can be found on the Walk Score API site. A status of 1 means a successful request. |
origin |
Latitude and longitude of the walkshed center. |
geometry |
Geometry type of walkshed. |
coordinates |
List of walkshed polygon vertexes, returned as a data frame with two columns. |
radius |
Network distance in miles. |
snappedLong |
longitude to which the input was snapped to. |
snappedLat |
latitude to which the input was snapped to. |
Visit www.walkscore.com for information on Walk Score and to obtain an API key
John Whalen
http://www.walkscore.com/professional/public-transit-api.php
## Not run: walkshed(-122.335,47.5815,"your key") ## End(Not run)
## Not run: walkshed(-122.335,47.5815,"your key") ## End(Not run)