Real Time Data on Charlottetown Bus Locations

Peter Rukavina

Charlottetown’s buses are now equipped with GPS devices that send real time location data to a server where it can be used by the ReadyPass transit app for iOS and Android.

There’s also a web version of the map, and, by looking under the hood of it, you can see that there’s a simple public API endpoint that provides the same real time location data.

To watch this for yourself, just open the web map in your browser, and open up the developer console, switch to the Network tab, and filter for XHR requests:

Screen shot of the developer console in Firefox while watching ReadyPass Charlottetown map

What you’ll see happening there is a regular call to get the position of the buses on the route you’ve selected, in the form:

http://charlottetown.readypass.ca/api/bus/route/ROUTE

For example:

http://charlottetown.readypass.ca/api/bus/route/1

The returns a JSON object with data for all of the buses currently on that route, like this:

[
  {
    "busNumber":"62",
    "routeNumber":"1",
    "lat":46.264949798583984,
    "long":-63.14606475830078,
    "cellStrength":0.017,
    "speed":0,
    "updateTime":"2018-05-03T20:47:10.342189124Z",
    "maxBump":0,
    "avgBump":0,
    "bumpSamples":0,
    "accuracy":100,
    "battery":255
  },
  {
    "busNumber":"60",
    "routeNumber":"1",
    "lat":46.239139556884766,
    "long":-63.13039779663086,
    "cellStrength":0.007,
    "speed":5.4,
    "updateTime":"2018-05-03T20:47:10.401472557Z",
    "maxBump":0,
    "avgBump":0,
    "bumpSamples":0,
    "accuracy":100,
    "battery":255
  }
]

So that tells us that, right now, there are two buses, #62 and #60, and they are at the latitude and longitude given. Also available, it seems, is the call strength of the data connection in the bus, its battery level and the accuracy of the position.

This is great data to have access to and, as has happened in other jurisdictions, will enable the creation of useful transit information services and data visualizations.

Add new comment

Plain text

  • Allowed HTML tags: <b> <i> <em> <strong> <blockquote> <code> <ul> <ol> <li>
  • Lines and paragraphs break automatically.

About This Blog

Photo of Peter RukavinaI am . I am a writer, letterpress printer, and a curious person.

To learn more about me, read my /nowlook at my bio, listen to audio I’ve posted, read presentations and speeches I’ve written, or get in touch (peter@rukavina.net is the quickest way). 

You can subscribe to an RSS feed of posts, an RSS feed of comments, or a podcast RSS feed that just contains audio posts. You can also receive a daily digests of posts by email.

Search