-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show bus position on map, either simulated or using real-time data #176
Comments
Icons being used for vehicle positions in HART's new web UI are here: |
* See docs at http://developer.onebusaway.org/modules/onebusaway-application-modules/current/api/where/methods/trips-for-route.html * This allows us to get active information about all current trips for a route, including status information, which includes vehicle position (towards #176) * Also add unit test for API * This also fixes a bug in ObaTripStatus that was preventing vehicle position from being correctly populated from the JSON response. More unit tests have been added to check that vehicle position is being parsed correctly in both ArrivalsAndDeparturesForStop and TripsForRoute API responses.
…n route mode TODO: * Vehicle map icon (including orientation of vehicle and popup balloon contents * Cleanup of code related to icons * Keep animation movement of buses? Can be strange when bus moves off a road and cuts corners - should we snap it to the route line, if that is possible?
Arrow icon by Zlatko Najdenovski, MK (https://thenounproject.com/icon/63549/), marker icon by Housin Aziz, SE (https://thenounproject.com/term/map-marker/37239/), bus icon from Google Material Design (https://github.com/google/material-design-icons/blob/master/maps/svg/production/ic_directions_bus_48px.svg). |
I've been working on showing vehicle positions in the "routes" view in my spare time. Progress is in this branch: ...and it currently looks like this: Tapping on the vehicle icon will open a marker balloon that has the route/headsign info, the status (e.g., "3 min delay"), and how recently the information was updated. |
* Show real-time vehicle position information (when its available in route map mode, and show interpolated vehicle position based on schedule data when real-time data isn't available * Uses trips-for-route OBA REST API endpoint - status.lastKnownLocation is used for real-time position, and status.position is used for interpolated position based on schedule data * Black PNG vehicle icons are included in the project, and then colored dynamically for each status (early/ontime/late/schedule) and direction, and then cached in VehicleOverlay * Only animate the movement of the vehicle icon if the new position is withina threshold of another - otherwise, just snap icon to new position * ActiveTripIds are used to track active vehicle markers on the map - we can't use vehicleId in overlay HashMaps to keep track of vehicles because we want to show an interpolated position (based on schedule data) for trips without real-time data, and those statuses do not have vehicleIds associated with them, but do have activeTripIds
Fixed in Here's what the vehicle markers and popup balloons look like for real-time data (left) and schedule data (right): Markers on map are color-coded according to early/ontime/late/schedule colors. Currently polling rate for trips-for-routes API in route mode is 10 seconds, and that's when the marker positions and balloon contents are updated. Tapping on the marker balloon takes you to the TripDetailsActivity for that For schedule-based positions, it turns out that OBA already interpolates a position based on schedule data, and this information is available in the trip status element returned by the API. Future work should focus on making the "route mode" more easily discoverable - primarily:
Future work could also add a thread to continuously update the "Data updated X min/seconds ago" text in the marker balloon every second, so it ticks up in real-time. |
I just added the source SVG files for the marker icons to the |
I just opened this ticket on iPhone as well (https://github.com/OneBusAway/onebusaway-iphone/issues/320), but I wanted to mirror here so we have a reference specific to Android as well.
This was something that @caitbonnar and @jrharshath discussed the other day, and I wanted to capture some info/links related to this.
We have all the data we need to simulate the bus position based on a particular trip and schedule (from GTFS / OBA REST APIs) as well as the current time. If we have shapes.txt in GTFS we can simulate precise position, if not position simulation will be rougher.
Real-time vehicle position is a little harder - from what I can tell the OBA REST APIs don't have a way to pull back vehicle positions related to a single route/trip(See additional comments below - OBA REST API trips-for-route returns all active trips per route, which include astatus
element that has real-time and interpolated vehicle position information). However, the OBA SIRI APIs that MTA deployed in NYC do. So, going forward, it would probably make sense to do real-time vehicle position based on the SIRI APIs. I don't believe the SIRI APIs are plug-and-play yet with the rest of the OBA core app modules server-side, but hopefully that will happen soon.Related items:
This issue is also related to showing route flow lines (https://github.com/OneBusAway/onebusaway-iphone/issues/319), since a moving vehicle on the map would also indicate direction of flow.
The text was updated successfully, but these errors were encountered: