Similar to the R version in another project about NextBus Vehicle Locations
Requires Python Pandas
, Shapely
, Matplotlib
, and Basemap
from mpl_toolkits
This project is a work in progress. The implementation is incomplete and subject to change. The documentation can be inaccurate.
The current way of calling the script is:
./plot_dataframe_nextbus_vehicle_locations.py [-i contain_geom] [-m maptype] \
agency-code route-code
where agency-code
is the transit agency code in the NextBus system (some examples below), the route-code
the route in the NextBus system, the optional -i contain_geom
is the containing geometry only inside which to draw the vehicles whose real-time location is of interest of this route (the contain_geom
is an OGC WKT
string in the WSG84 coordinate system with longitudes first and latitudes later -longit, latitude-), and -m maptype
is the desired underlying Google Map background (maptype
is one of the values hybrid
(default), roadmap
, mobile
, satellite
, terrain
, mapmaker-roadmap
, or mapmaker-hybrid
).
Note that the route-code
is exact, e.g., for the example of the Los Angeles Metro
, the route 20
refers only to route 20
and not to other colinear routes in a similar path, like routes 720
.
For the map with the real-time locations of the vehicles servicing San Francisco Municipal Transportation Agency - Route 38 Geary Blvd
only inside the area (closed polygon) around Geary Blvd and Divisadero St, with a hybrid
background:
./plot_dataframe_nextbus_vehicle_locations.py \
-i 'POLYGON((-122.458 37.76, -122.42 37.76, -122.42 37.82, -122.458 37.82, -122.458 37.76))' \
-m hybrid \
sf-muni 38
A sample is below:
For the map with the real-time locations of the vehicles servicing Toronto Transit Commission - Route 39 Finch Ave East
only inside the area (closed polygon) around Finch station:
./plot_dataframe_nextbus_vehicle_locations.py \
-i 'POLYGON((-79.446 43.780, -79.386 43.780, -79.386 43.789, -79.446 43.789, -79.446 43.780))' \
-m hybrid \
ttc 39
A sample is below:
For the map with the real-time locations of the vehicles servicing Los Angeles Metro, Route 720, Downtown LA - Santa Monica - Commerce via Wilshire Blvd
, without a limiting area for plotting the
transit buses inside it:
./plot_dataframe_nextbus_vehicle_locations.py lametro 720
A sample is below:
For the map with the real-time locations of the vehicles servicing New York City Metropolitan Transportation Authority - Bronx Bx12 Broadway Inwood - Bay Plaza
, without a limiting area:
./plot_dataframe_nextbus_vehicle_locations.py bronx BX12
A sample is below: