This is the Google Earth version of the famous University of Michigan "Magic Bus" page. There are two versions - the Markers  and the 3D Bus . The data is pulled every 3 seconds.

This is the old version. mbus has moved to doublemap and the feeds have changed. These are the new entry points:

I am pulling the mbus live feed The file looks like this:

    <route>Intercampus to East Campus</route>

I wrote two Perl scripts, one for the Markers version ( and one for the 3D Bus version ( The scripts pull the live feed and convert it to a .KML file. There are a few important things about these scripts. The returned .KML has to be valid (otherwise Google Earth freaks out - sometimes not so gracefully). The first line has to be the mime type. I just use a statement like this:

print "Content-type: text/html\r\n\r\n";

Afterwards the script has to print some opening KML statements and at the end some closing KML statement, like in the Markers version:

print "Content-type: text/html\r\n\r\n";
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print "<kml xmlns=\"\">\n";
print "<Document>\n";
print "\t<open>1</open>\n";
print "\t<Style id=\"bus\">\n";
print "\t\t<scale>0.5</scale>\n";
print "\t\t<IconStyle>\n";
print "\t\t\t<Icon>\n";
print "\t\t\t\t<href></href>\n";
print "\t\t\t</Icon>\n";
print "\t\t\t<hotSpot x=\"0.5\" y=\"0\" xunits=\"fraction\" yunits=\"fraction\"/>\n";
print "\t\t</IconStyle>\n";
print "\t\t<ListStyle>\n";
print "\t\t</ListStyle>\n";
print "\t</Style>\n";

... create <Placemark>s ...

print "</Document>";
print "</kml>\n";

In the center of the code all the <Placemark> are created, like in the Markers version:

print "<Placemark>\n";
print "\t<styleUrl>#bus</styleUrl>\n";
print "\t<name>$1</name>\n";
print "\t<description>$5 ($4deg)</description>\n";
print "\t<Point>\n";
print "\t\t<coordinates>$3,$2</coordinates>\n";
print "\t</Point>\n";
print "</Placemark>\n";

The file that is used in Goolge Earth just calls the script every 3 seconds - which is very simple, like in the Markers version:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="">