Archive
Updated Metrostop.org
It took much longer then I had expected, between work actually picking up, running into a few unexpected hickups with IE and learning Rails, I finally have a much improved metrostop.org.
This was almost a complete rewrite from my previous PHP.
The list of improvements include:
* Scalable Map – resizes with the browser width/height
* Back Button Support – after searching clicking the back button will return to the previous state
* Caching – I use a lot more caching now so performance should be much better
Updates: (things I forgot to mention)
* Entrance Level data
* Search Certainty raiting stars
* Nearly Validating markup all but the MS specific namespace validate
Metrostop Back Up
Fixing things was actually really easy. JSON is really nice.
On the server I had to update the regular expression to extract the JSON. I’m actually thinking about reworking this further to support the back button. I’ll load the google data into an iframe. Adding a function to the parent window that the iframe calls. This way onunload I can control the unwind and onload the forward is already encoded.
For now regex:
header('Content-Type: text/javascript');
$address = strip_tags($_GET["address"]);
$q = urlencode( $address );
$query = 'http://maps.google.com/maps?q=' . $q . '&output=js';
$json = trim( file_get_contents( $query ) );
$json = preg_replace( "/.*html *.*CDATA\[/", "", $json );
$json = preg_replace( "/function onLoad\(\) {window.parent.loadVPage\(/", "", $json );
$json = preg_replace( "/,document.getElementById\(\"state\"\)\);}\/\/\]\]>.*/", "", $json );
echo $json;
and on the client:
var data = window.eval( "(" + txt + ")" );
var point = new GPoint( data.overlays.markers[0].lng, data.overlays.markers[0].lat );
Google Maps Switched to JSON
Looks like the google maps backend format has switched to JSON. This is great as it’s much nicer format to work with then XML. However, it does mean for a while metrostop will be out of commision.
Metro Meeting
Man, my big chance to plug metrostop.org and I’m going to be out of town in Austin
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.
Quest for Station Entrance Data
I have figured out how to more accurately represent stations, by including each stations entrance. My simple approach is to just plot each stations entrance as a marker of the station.
The tricky part is getting the location data for each station entrance. I’m hoping I will not have to go through and manually figure out the geocoordinates for each station entrance, but because wmetro.com doesn’t provide accurate entrance information it appears I will be forced to go through this process manually
If anyone has any suggestions about how to get this data, I’d love to find out otherwise it looks like over the next month or so I’ll be building this data manually.
Since, I’m a frequent user of Farragut West, I figured that station out and you’ll notice it appears on the map now twice, since it has two entrances. The search algorithm handles this correctly, so if you search for the nearest station to “1590 I St. NW, Washington, DC” for example you’ll get Farragut West now instead of Farragut North. Now that may change again once I finish plotting the alternate entrances to Farragut North, but for now it’s at least more accurate then before.

Recent Comments