Charlottetown Bus + Google Maps

The code described here has been moved into Subversion.
Details and installation instructions.

I don’t read printed bus timetables very well. So I created the Charlottetown Transit Interactive Bus Map:

Interactive Charlottetown Transit Map Screen Shot

This is a little Google Maps hack that uses PHP and JavaScript to display information about Charlottetown bus routes and schedules.

This is just a tentative first go; specifically:

  • Only the Winsloe — University Ave. line is included (it’s the only one in operation as I write).
  • Stop and route location may be incorrect; I simply recreated this as best I could from the published schedules and maps. If you find problems, please let me know.
  • I left out the early morning and early evening swings to the Garfield St. terminal.
  • Assumes a Big Browser Window (map is 700 pixels wide); future versions should be more flexible.
  • No allowance made for the fact that there are no buses on Sundays.
  • Doesn’t span days — after the transit day is over, all times display as “n/a”.

You’re welcome to grab the source and the data and improve. Steven says I need a source code repository for all my little code experiments; expect this soon.

It goes without saying that this project is unaffiliated with the City of Charlottetown or the transit operator; if it breaks, or sends you to the wrong place at the wrong time, it’s my fault, not theirs.


Erin's picture
Erin on October 3, 2005 - 04:16 Permalink

There is no bus whatsoever on Sundays?? I know lots is closed, but people still need to get around on Sunday.

DerekMac's picture
DerekMac on October 3, 2005 - 12:11 Permalink

Cool! I hope the City runs with this and incorporates it into their website. Next step would be for each bus to have a GPS, and transmit real-time location coordinates, so that the map could display where the bus/trolleys actually are.

Off to look out the window to see if the bus actually shows up in front of my building at 08:18!

Olle Jonsson's picture
Olle Jonsson on October 3, 2005 - 12:38 Permalink

This is awesome.

Awaiting the SVN/darcs repo with shiny eyes.

Peter Rukavina's picture
Peter Rukavina on October 3, 2005 - 13:18 Permalink

Bug in MySQL query found and corrected; corrected source to follow shortly.

Peter Rukavina's picture
Peter Rukavina on October 3, 2005 - 13:52 Permalink

A little more live tweaking made things shaky for ~15 minutes, but we’re back. 9:54 a.m. bus just drove by (I heard the trolley bell, just like Mr. Rogers Neighbourhood).

Greg's picture
Greg on October 3, 2005 - 14:09 Permalink

Hi Peter,
Nice work on the map. Although I am not seeing the stops coming up. I am testing with the Google Maps as well, hwo are you geocoding the points on the map? Any program or website you are using to get the coordinates?


Greg's picture
Greg on October 3, 2005 - 14:13 Permalink

Actually, I see the points in Firefox but not in IE 6.

Greg's picture
Greg on October 3, 2005 - 16:05 Permalink

Did some searching around why it was not working with IE 6. Please check here to see how to get it working with IE.…


Andrew's picture
Andrew on January 3, 2006 - 18:56 Permalink

Is it possible to add the option of Map, Satellite, and Hybrid to the top right of the map like regular google maps does?

Peter Rukavina's picture
Peter Rukavina on January 3, 2006 - 19:04 Permalink

Andrew: I’m reluctant to add this because of the poor registration between the map layer and the satellite layer in Google Maps’ layers for Charlottetown. I’ve registered the bus routes against the map layer.

Ryan Palmer's picture
Ryan Palmer on October 13, 2006 - 08:31 Permalink


Nice work on the transit map. Thanks to your efforts I was able to create a couple of database-fed slides for the campus information system thing here at UPEI (Campus Screens Project).

It’s a pretty recent addition to the project, so it’s still pretty rough, but you can check it out here:

Let us know what you think!



kankan's picture
kankan on November 22, 2006 - 08:39 Permalink

that is a good idea
it is so kind of you shareing your code

Bob Bourne's picture
Bob Bourne on December 9, 2006 - 06:10 Permalink

I am a transit consultant specializing in small bus systems and I have been examining the parameters of the proposed transit study. Is there a person that I could communicate with regarding the current service and who will also be able to answer some questions about the community?

Bob Bourne
Ames, Iowa

danny's picture
danny on March 30, 2007 - 01:38 Permalink

great map and system. is there a code or program that can be used offline for people who dont have internet so that they can use the map info.

Peter Rukavina's picture
Peter Rukavina on March 30, 2007 - 18:37 Permalink

There’s no code to allow for offline usage, but it’s conceivable that you could grab the MySQL data and craft your own.

Dean's picture
Dean on April 19, 2007 - 19:40 Permalink

Very interesting use of Google Maps.

thanks for sharing your ideas / process on this.