Tuesday, April 3, 2012

Shanghai Busroutes

I don't know if anybody else will ever need this, but I've made a searchable index of Shanghai's bus routes here.

It was designed to search bus stop to bus stop using the stop names. If your search term doesn't match a stop name the system will make a best guess based on something called Levenshtein Distance.  Now I'm sure Mr. Levenshtein was a very bright man but, based on my testing, relying on LD-based computerized guesses to find my way around Shanghai will result in my inner organs getting harvested so so I wouldn't even try.

As a simple usage example, if you want to to get to the People's Square (Fuzhou Road) station from the Jinke Road, Zuchongzhi Road station, first type "Jink" into the "From" box and wait for the list of relevant stops to be brought up:

Now, click on the stop name in the dropdown. This will select that stop and set the value of the text box. You will not have to remember the bus stop's name. Thankfully Shanghai bus stops are rationally named. Anyway, do the same for the "To" box and click "Search".

Voila! The power of technology will tell you that you'll have to take two rides. First the Sunqiao1Line for 3 stops, then the XinchuanLine for 21 more:


24 is a lot of stops.
Finally, if you click on the line name it will be expanded:


The relevant stops are even highlighted. Pretty cool. Worth importing a whole Javascript file to achieve that effect? You tell me. But hey, I'm doing this for the learnings.

The system itself has been up for a while but the domain baldwinternet.com is new. Click on the banner for "documentation" (it sucks). I'll try to go over some of the code in this blog in the future. Until then hey you won't ever be lost in Shanghai again. Travel safe.

Again, it's www.baldwinternet.com/busroute/

Mark

No comments:

Post a Comment