Frequently Asked QuestionsAbout the Interactive Subway MapQ How does the Java version of the map work? A It's a Java applet. That means that when you run it, a small Java program is downloaded by your web browser and run inside the Java "virtual machine". The Java program that is downloaded is the same regardless of the type of computer you have. The Java virtual machine on your computer is responsible for translating the Java program into something that your particular type of computer can understand. Q How does the Google Maps version work? A The Google Maps version uses the Google Maps API, which is provided by Google. It lets a JavaScript program do things like move the map, and add markers and lines. The actual subway route calculation is done by a CGI program that runs on www.brail.org, and the results are returned to the JavaScript code that runs on your web browser and renders the map on the screen. Q What if I find an error in the data? A Please let me know via email! The Google Maps version is new, and the locations of many of the stations may be incorrect. Q My web browser is saying that I don't have Java. How do I get it? A Some computers don't come with Java installed. For instance, not all versions of Windows XP come with Java. You can install the latest version quickly and easily by going to java.com. Q Aren't applets bad? A This applet has been on the Internet since 1996. You tell me! But seriously, applets have a bad reputation due to some security problems with the very first versions of Java that were fixed in the 1990s; because people still mistakenly believe that Java is slow; and because for a time, folks were developing huge applets that tried to do too much. An applet like this one, which is tiny, and which doesn't need to do anything like access your hard drive, is a great example of the appropriate use of an applet, and it's perfectly safe to run on your computer. Q OK, but how does it figure the shortest route? A The applet reads a small data file from the web site that contains information about every subway station, and about the links between each station. Each link contains additional information about which line connects the two stations, what time the two stations are connected using this line, and a weight. The weight is used to account for longer runs between stations, such as those that cross under the East River. Special links are included in the data to represent transfers between stations. The CGI program that runs the Google Maps version is the same, except that the data file lives on the web server, and the CGI program reads it from there. When you select two subway stations, the applet uses a "priority-first search" algorithm. Starting at the first station, it builds a potential subway route to each station that has a link to that station. It puts that route in a "priority queue". Once it's done that for the current station, it removes the link with the smallest total weight from the priority queue, and creates routes with every station with a link to that one, and puts the new set of routes back in the priority queue. The first route that reaches the destination station is the best route, and it is displayed on the screen. The best route is the one with the smallest total weight from one station to the other. This algorithm is nothing magic. It is often given as a programming assignment to undergraduates in computer science. My implementation has additional smarts to deal with things like "cross-platform" transfers between lines, so it doesn't have you jumping from one train to the other over and over when you'd be better off staying on the local for your whole trip. Q Where does the data come from? A I typed it in. Mostly, I did this when the applet first went on the Internet, in 1996. I guess I had more free time then. Since then, I've written a program to convert the data to XML, which I can edit more easily. The source of the map data is a single XML file of about 500K, which is parsed and converted into a binary data file of about 50K, which is then compressed down to about 14K for quick downloading to your browser. Q How many people use this applet? A According to my web hoster, the applet gets about 2000 "hits" a day, corresponding to between 800 to 1000 unique users a day. This has been pretty constant for a few years now. More people use the applet when big events happen in New York. On September 11, 2001, the volume tripled. Q I heard there was a version for the PalmPilot. Where is it? A I don't know! I've heard this too. I don't know if the rumors are about a version of this applet, or just a static map. If you know, please give me more details! I have experimented over the years with PalmPilot and cell phone versions of this applet. The programming is actually not that hard -- as long as you don't mind scrolling through a list of several hundred subway stations on your cell phone. But every cell phone maker and cell phone network seems to have their own way to make an applet available for distribution, and I just don't have time to do that. Q Can I use the applet to make my own map? A You sure can. You need to be able to create an XML file, and you need an image to use for the map. Other than that, the software is totally flexible and knows nothing about New York or any other transit system. Unfortunately, I don't have easy instructions for how to do this, but send me an email and I'll show you how. Q Can I link to your web site? A Yes. I'd appreciate it if you dropped me an email, but other than that, go ahead. Q Can I copy the applet to my own web site? A The map applet and data are free. If your web site is actually on the public Internet, I prefer that you link to my site instead. That way you'll get any updates I make automatically. If your web site is on your internal network and it can't reach the Internet, however, then you may copy the various files to your site. However, you must mention my copyright, which appears on the main HTML page and in the applet itself. You also must mention the copyright of Michael Calcagno, who created the data. Q Can I sell a commercial product that includes your map applet? A The applet is free. I have no way to enforce the way it is used. However, I retain the copyright to the applet itself. If you use it in a commercial product or if you incorporate a copy of it into your own web site or kiosk, you must mention my copyright along with all the other copyrights you put in your product. Q Can I use the New York or London map data in my own project? A The map data itself is free, and I have not copyrighted it. It's based on a real subway system, after all. But maintaining this data is tedious, boring work. If you'd like to help, you're more than welcome! If you're interested, here are links to the data:
Q Can I pay you to consult for me and make this map part of my product? A No. I have a full-time job as a software developer. I am not able to take on any side projects for money. If you pay me, then I have to respond to requests in a timely manner, and that's not possible for me, since this is not my real job. Q Can I help? A I would love to have some help keeping the map data up-to-date. I'm restructuring the XML file so that it's easier to manage. But so far, since 1996, no one has offered. Q Can I have the source code? A I have no plans to release the source code. The applet is, as they say, "free as in beer."I am retaining the copyright on the source code, but you may copy and redistribute it as many times as you want in binary form. Frankly, most of the requests that I get for source code come from college students who need help with their computer science homework. Q How do I contact you? A The email domain is "brail.org", and the user name is "javatransit". Thanks to the spammers who have made e-mail useless, you'll have to put the two parts together yourself. Copyright (c) 2004 Gregory J Brail. All rights reserved. |