Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bustimePGH

This program processes Pittsburgh's Public Transit routes and stops information as JSON data through the Bustime API

Request an API key from Port Authority's website: https://www.rideprt.org/business-center/developer-resources/

Setup

  1. Install dependencies:

      npm install

  1. Create a config folder, then create a .env file inside config

  2. List your key/value in your environment variables as follows:

      BUSTIME_API_KEY = 'KEY_GOES_HERE'

  1. Run bustime.js

getroutes

Required Parameters -> (API key)
/bustime/api/v3/getroutes?key=${BUSTIME_API_KEY}


Returns
(route, route name, route color, route display designator, rtpidatafeed)

Example: 
    <bustime-response>
    <route>
        <rt>1</rt>
        <rtnm>FREEPORT ROAD</rtnm>
        <rtclr>#3300cc</rtclr>
        <rtdd>1</rtdd>
        <rtpidatafeed>Port Authority Bus</rtpidatafeed>
    </route>
    <route>
        <rt>11</rt>
        <rtnm>FINEVIEW</rtnm>
        <rtclr>#ffccff</rtclr>
        <rtdd>11</rtdd>
        <rtpidatafeed>Port Authority Bus</rtpidatafeed>
    </route>
    ...
    </bustime-response>

getdirections

Required Parameters -> (key, route, rtpidatafeed)
/bustime/api/v3/getstops?key=${BUSTIME_API_KEY}&rt=${busRt[i]}&rtpidatafeed=${rtpi[0]}

Returns
(direction)

*Some bus routes such as rt='11' only contain an INBOUND or OUTBOUND direction. All 3 trolleys are both INBOUND && OUTBOUND, as are most bus routes.

Example:
    <bustime-response>
        <dir>
            <id>OUTBOUND</id>
            <name>OUTBOUND</name>
        </dir>
    <bustime-response>

getstops

Required Parameters -> (key, route, rtpidatafeed, direction)


Returns
(stop id, stop name, latitude, longitude)

Example:
    <bustime-response>
        <stop>
            <stpid>213</stpid>
            <stpnm>7TH ST + FT DUQUESNE BLVD</stpnm>
            <lat>40.444445000001</lat>
            <lon>-80.000735</lon>
        </stop>
        <stop>
            <stpid>12626</stpid>
            <stpnm>7TH ST + PENN AVE FS</stpnm>
            <lat>40.442939999999</lat>
            <lon>-80.000191000002</lon>
        </stop>
    <bustime-response>

About

API for public transit in Pittsburgh

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages