Skip to content
This repository has been archived by the owner on Nov 30, 2023. It is now read-only.

GoogleRandomQueries

bdferris edited this page Sep 26, 2014 · 1 revision

This program reads a GTFS feed file and generates a web page with randomly generated test links that you can open with your internet browser, allowing you to test the quality of the feed in the Google Maps transit trip planner.

How to use the Random Queries Tool

Step 1: Download and install the program

Microsoft Windows

  • Point your internet browser at http://code.google.com/p/googletransitdatafeed/downloads/list
  • When running the following commands you should substitute {{{}}} and {{{}}} with the month and year of the package you downloaded!
  • Download the most recent zip file with name {{{“random-queries-windows-_.zip”}}}
  • Unzip {{{random-queries-windows-_.zip}}}. This will create a folder called random-queries-windows in the current directory.

Platform independent

  • Point your internet browser at http://code.google.com/p/googletransitdatafeed/downloads/list
  • Download the tarball with name {{{“transitfeed-.tar.gz”}}} (pick the most recent release)
  • When running the following commands you should substitute {{{}}} with the release of the package you downloaded!
  • Open a command line terminal (like xterm, bash, tcsh, sh, MS Windows command)
  • Unzip {{{transitfeed-.tar.gz}}} using the command {{{“tar xvfz transitfeed-.tar.gz”}}}. This will create a folder called {{{transitfeed-}}} in the current directory.
  • Navigate into the folder {{{“transitfeed-”}}}
  • Issue the following command to give executing rights to the setup procedure: {{{ chmod a+x setup.py }}}
  • Install the necessary {{{“transitfeed”}}} python module using the command {{{“sudo ./setup.py install”}}} if you do not have root access rights or just {{{“./setup.py install”}}} if you do have root access rights.

== Step 2: Run the program ==

Microsoft Windows

  • Open a command prompt. Easiest way is to click {{{"Start" -> "Run.."}}} type {{{"cmd"}}} and click Ok.
  • Navigate to folder {{{“random-queries-windows”}}} using the DOS command {{{“cd”}}}
  • Type command: {{{“google_random_queries.exe ”}}}
  • If contains spaces be sure to put double quote around it
  • This will create an HTML file named google_random_queries.html in the same directory as google_random_queries.exe
  • Specific options you can use to customize the program’s behaviour: {{{ --limit=LIMIT: set the maximum number of random queries to generate to --output=FILE: write the random queries to --version: show the version number --help: show a help message }}}

Platform independent

  • Open a command line terminal (like xterm, bash, tcsh, sh, MS Windows command)
  • Navigate into the folder {{{“transitfeed-”}}}
  • Type command: {{{“./examples/google_random_queries.py }}}
  • This will create an HTML file named google_random_queries.html in the current directory
  • Specific options you can use to customize the program’s behaviour: {{{ --limit=LIMIT: set the maximum number of random queries to generate to --output=FILE: write the random queries to --version: show the version number --help: show a help message }}}

== Step 3: Test the feed in preview using random queries ==

Execute the following steps to test your feed data:

  • Open the HTML file generated by the Random Queries Tool with your internet browser
  • Click with your mouse pointer on the links in the page ([#Screenshot_1 screenshot 1])
  • The Google Maps site will open and on the upper left you will find a form with title “get directions” ([#Screenshot_2 screenshot 2]) containing:
    • three tabs: “By car”, “By public transit”, “By foot”. “By public transit” is selected (color: blue)
    • (A) a departure point expressed in latitude & longitude values
    • (B) an arrival expressed in latitude & longitude values
    • a box containing the departure date and time.
  • These values encode a random trip query that can be tested by clicking with your mouse pointer on the “get directions” button on the lower right in the “get directions” form.
  • If Google Transit finds an available itinerary that uses public transport it will display it graphically on the map ([#Screenshot_3 screenshot 3]).
  • If Google Transit does not find an available itinerary that uses public transport it will display a message that states: {{{“Sorry, we don't have transit schedule data for a trip from , to , at the time and date you specified.”}}}. In this case:
    • try to change date/time
    • consult the troubleshooting section of this document
  • When Google Transit finds a valid itinerary you should check the quality by considering the following issues:
    • Check the agency attribution under the trip results ([#Screenshot_4 screenshot 4]):
      • has correct name and spelling of the agency
      • opens a page with general information about the service
    • For each alternate trip check that each of these is reasonable:
      • the total time of the trip
      • the time for each leg. Bad data frequently results in a leg going a long way in a few minutes.
      • the icons and mode names (Tram, Bus, etc) are correct for each leg ([#Screenshot_5 screenshot 5])
      • the route names and headsigns are correctly formatted and not redundant. For a good example see the screenshots in the General Transit Feed Specification.
      • the shape line on the map looks correct. Make sure the polyline does not zig-zag, loop, skip stops or jump far away unless the trip does the same thing.

== Step 4: Improve the testing process with the following suggestions ==

  • Test trips on different dates. The queries are for dates 0-7 days after google_random_queries was run at random times of the day. When a request for a date in the past is sent to Google's trip planner it is ignored and todays date is used. Thus to get results from different days of the week use a HTML file created in the past few days. The queries it generates are between locations within a 1km square box surrounding two random stops.
  • Gain efficiency. You may want to open 5 to 10 queries in different browser tabs to save flipping back and forth between the HTML and maps. You can achieve this by right-clicking (right mouse button, or {{{}}} & left mouse button, Apple Mac OS X users should use {{{}}} + mouse button) the random query links.

= Troubleshooting =

Problem: The random queries generates itineraries that don’t include public transit.
Possible causes:

Google transit does not have data for your service on the date in the URL.

* *Solution*:  generate random queries multiple times on different dates. The tool generates queries for the next 7 days.

You have very sparse or disconnected service areas.

* *Solution*: try changing the time in the URL to one you know should work.

The query start and stop points are not close enough to a transit station provided by the agency in their feed.

* *Solution*: move start and stop points of the query close to a transit station provided by the agency

Your transit data has expired.

* *Solution*: submit an updated feed to Google transit program. You will have to wait one or two weeks until the new data will be available in the preview 

= Online Resources =

Use the following links if you can’t find what you are looking for in this document: