1.0.3 • Published 7 years ago
tallygo-js v1.0.3
TallyGo-JS 
TallyGo navigation API wrapper in Javascript. Also features component to animate iOS and Android client location updates on a map.
Quick start
Install via npm:
npm install tallygo-js
yarn add tallygo-jsOr as a script tag:
<script src="https://unpkg.com/tallygo-js@1.0.3/dist/tallygo.min.js"></script>See the examples directory for browser usage.
API
const TallyGo = require('tallygo-js');
const tallygo = TallyGo.configure({apiKey: '<YOUR API KEY>'})
const requestOptions = {
startPoint: [34.76151710, -112.05714849],
endPoint: [34.76260434, -112.01666952],
time: '2018-11-13T01:31:51-0800'
course: 0,
speed: 0,
requestType: 'DepartureTime',
useCarpoolLanes: false,
useExpressLanes: false
}
tallygo.request.get(requestOptions).then(
function(json) { console.log(json) }
)The JSON response object has the following structure:
distance(number) - the total travel distance in milesduration(number) - estimated travel time in minutes. Will always be a sum ofpoints.toriginalStartNode- start node ID of the edge that start point lays onoriginalEndNode- end node ID of the edge that end point lays onrouteSegments(RouteSegment) - 1 or more legs for this route.distance(number) - the total travel distance in miles for this legduration(number) - estimated travel time in minutes for this leg.originalStartNode- start node ID of the edge that start point lays on, for this legoriginalEndNode- end node ID of the edge that end point lays on, for this legpoints(Point) - every point in the route in sequencelat(number) - latitudelon(number) - longitudet(number) - estimated travel time in seconds from the previous pointd(number) - the distance in miles from the previous pointsayoptional (string) - the instructions to be spoken at or near this pointnotifyoptional (string) - the out-of-app notification to be displayed at or near this pointturnoptional (Turn) - the turn at this pointdir(TurnDirection enum) - the direction of turn (or destination, when applicable)st(Street) - the street being turned ontoname(string) - The name of this streetfunc({highway, localhighway, arterial, localarterial, residential, service}) - the function of the streetconnectionoptional ({origin, offramp, onramp, interchange, connector, destination})diroptional ({north, south, east, west}) - the directionality of the streethwyoptional (HighwayId) - more information about this street if it is a highwaynumber(number) - the number of the highwaytype(string) - ({CA, US, I, Hwy, CR, SR}) - the type of highway
instructoptional (string) - The text describing the turn instruction for the turn-by-turn list
nodeoptional (number) - OSM node id associated with the pointedgeoptional (number) - OSM way id which starts with this point
The library provides a convenience class for working with Route objects.
tallygo.request.get(requestOptions).then(
function(json) {
let route = tallygo.newRoute(json)
// do something with the Route object
}
)Development
Set up:
yarn installTest:
yarn testBuild development bundles
yarn build:devgenerates javascript bundles in the /dist directory.
Build documentation
yarn build:docsgenerates html documentation in the /documentation directory.
Run the development Server
yarn startWith development server running see the examples: http://localhost:9966/examples/
Documentation is available here: http://localhost:9966/documentation/