Metro Seems to have finally caught on?
Not sure it’s as complete or useful as my own… well, I’m sure it’ll quickly pass metrostop.org in that department… it was an interesting project to say the least.
Not sure it’s as complete or useful as my own… well, I’m sure it’ll quickly pass metrostop.org in that department… it was an interesting project to say the least.
Alright I got a real domain for my metro maps project and even can say it supports all the major browsers now, including IE.
The main problem I was having in IE was caused by my lack of understanding how VML works in the browser. Reading the maps FAQ really helped clear things up.
The fun stuff is in showing metro alerts in the upper right hand corner. I setup my server to check the metro RSS feed once every hour. The php for this is really straight forward RSS using PHP DOM calls.
source: metro3.tar.gz
I hope to get back to XUL coding soon, but for the time being it looks like my work is going to force me into writing cross browser code.
Made a few improvements to the metro maps.
1. Works in Opera and Safari, still no IE.
2. Added a Search for locating the nearests Metro stop, given an address.
How it works:
To go from address to longitude/latitude, I used maps.google.com.
$query = 'http://maps.google.com/maps?q=' . $q .
'&output=js';
$gm = fopen( $query, 'r' );
if( !$gm )
return false;
$tmp = @fread($gm,30000);
fclose($gm);
$x = preg_replace ('/.* = 2 ){
$lat = $ret[0];
$long = $ret[1];
}
I learned about this technique while reading about geocoding here.
The algorithm for computing distances between longitude and latitude came from this link.
The rest of how it works is pretty straight forward – loop over all points, popup the mark at the end.
Update: Did I meantion – I’m in Barcelona!
D.C. Metro maps with Google Maps API for that extra touch of spice!
To build this map I first scrapped wmata using the scrap.php file to build a first pass of the stations.xml file. About 12 stations addresses did not resolve to valid addresses when back referencing maps.google.com. I had to manually figure out the lng lat for each of those.
The next thing that I had to do manually was enter each of the linked tags into the stations.xml file. This was really the only sucky part, but vi and split screen made it pass quickly.
I noticed the ajax part is busted in IE/Opera/Safari. Maybe I’ll fix that, but I suspect the DOM walking would be busted in IE anyway so I’m not sure I’ll bother, of course it would be nice if it worked everywhere
Recent Comments