-
Notifications
You must be signed in to change notification settings - Fork 309
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
Add bikeshare support #402
Comments
We now have GBFS support in our OTP fork, http://maps.usf.edu/. OTP consumes GBFS and offers the data up via a REST API call, very similar to what OBA does with real-time transit info. Here's the bike rental API call to OTP: HTTP request header:
And the OTP bike rental API docs: It seems they support geographic bounds, so we could use the same Sample response:
|
For parsing the response with Jackson, we should be able to leverage the POJOs in our opentripplanner-pojos library: This is how OTP Android parses the response, which can be seen in this code: |
In OTP Android, I believe we make the assumption that all returned entities are bike stations. At USF (including maps.usf.edu) and other locations, there are floating bikes w/ embedded GPS that aren't fixed to stations. So we might need to update the POJOs project to reflect this difference. |
Note that there is now a new GBFS implementation in OTP as part of TriMet's Mobility On Demand Sandbox project. Here's the GBFS branch - we should plan to use this implementation on this branch instead of our USF Maps project code. Here's a sample OTP bikeshare API endpoint for the above GBFS implementation: Here's a snippet of a sample response:
Note that we should configure more than one GBFS endpoint per region in OTP - Tampa currently has two, one for Coast Bikeshare and one for USF Share-A-Bull. |
For the initial "Layers" UX to show bikeshare floating bikes and stations on the map, I'd like to do something similar to what the Transit App is doing. When zoomed out, the bikes just appear as tiny dots on the map: However, when you zoom in further, they appear as tappable markers when zoomed in: The existing SVG files for the vehicle map icons for OBA Android are located in: We can copy/edit these for our bikeshare map marker icons. Material design icons are available at https://material.io/icons/. You can use this tool to generate the various resolutions and copy into project - https://romannurik.github.io/AndroidAssetStudio/icons-generic.html. |
For adding bikeshare to trip planning - Check out OpenTripPlanner Android to see how this is implemented there. We'll need to add icons for bikeshare modes - these should be added as black and tinted. Material design icons are available at https://material.io/icons/. You can use this tool to generate the various resolutions and copy into project - https://romannurik.github.io/AndroidAssetStudio/icons-generic.html. |
Here's our wiki page for 2017 Google Summer of Code project that will be working on bikeshare integration for OBA Android: |
Thinking more, a better model is probably the |
To summarize the above comments, full bikeshare support in OBA Android would include two things:
|
Just to confirm. On item 2, the bike stations and floating bikes will be displayed together with the bus stops? |
Yes for now. We may need to look at a "layers" concept, but for now let's
just show all bikes and stations when you zoom in far enough.
|
From @carvalhorr:
I think it's best to show as pop-up balloon from marker, like we currently do with transit vehicles after tapping on arrival time and selecting "Show route on map": Transit App does something similar: Only problem with this display is that you can only have one click listener for the entire balloon. So, when we tap on the vehicle marker, we take the user to the trip status activity. For the bike/station marker balloons, I think tapping on them should ideally deep link to that bike/station on the bikeshare vendors website or app. However, deep links aren't currently provided in GBFS, so this feature would require the adoption of MobilityData/gbfs#25. So for know, I'm not sure if tapping on the balloon should do anything, although I'm open to ideas. |
Should the markers be different for a bike station and a floating bike? What about marker size at different zoom levels? At the moment I'm showing Google Maps default marker, but I was planning to show something specific for bikes. Is there any guide for UI so I don't create something completely different? Or is there someone who could help with the UI? |
Yes, I would recommend different markers for station vs. floating bike, at least at closer zoom levels. See #402 (comment) for some info on markers, and let me know if you have more questions. Take a look at the material design icons and see if you can find a good one for bike and station/rack - feel free to comment with examples in this issue. |
From @carvalhorr:
If you’re talking about the OneBusAway region from the OBA Regions API: …the logic to select this region is in The So, for the current trip planning feature we assume there is a single OTP server per region (in both the OBA Regions API and OBA Android app), and that the correct router will be the default router. You’re fine sticking with these same assumptions for OTP bike share API. |
@carvalhorr After rereading your question, I think I may have misunderstood it. Can you configure OTP so that more than one GBFS feed appears under the For example, in the Tampa region, we currently have the USF Share-A-Bull Bikeshare system, and the City of Tampa has Coast Bikeshare, and each has their own GBFS API endpoint. We'd want both to be shown in OBA Android, so we'd need to consume both GBFS feeds in the OTP server for Tampa. |
I may not be using the right terminology, so let me explain what I did.
In OTP:
I created two directories under otp/graphs. One called "tampa" and other
called "portland". In each of these directories I downloaded the
corresponding OSM file for the region (I think I got the OSM from Mapzen,
but not sure). I also configured the GBFS for each of these directories in
the corresponding files "router-config.json". This mean I have two routers,
right?
With this configuration now I can hit the OTP server in two different
routers: /opt/routers/tampa/ and /otp/routers/portland/ in my localhost.
In OBA (using tampa region):
When I get the getBaseOtpUrl() from thecurrent ObaRegion (which I get from
Application.get().getCurrentRegion()) I get
https://otp.prod.obahart.org/otp/ ... and I still have to add
/routers/{router_id}/bike_rental/ ... I could not find a router_id that
matched "tampa" in the ObaRegion, so I used 'default" for the router_id.
For some reason, my OTP server maps requests to the default router to
tampa, but I don't remember to have configured this anywhere.
Is the router_id anywhere in the ObaRegion? There is a getRegionName, which
do not seem to be the router_id.
This is working fine so far, but I am just pointing out that if an OTP
server happens to have more than one router (like I have tampa and
portland) I am not sure what would happen.
|
I believe so, though to be honest most of my use of OTP servers came before the concept of multiple "routers" emerged.
No, we don't have any concept of router_ids in OneBusAway. We only have a single method related to OTP, the Are you able to configure OTP to consume more than one GBFS feed per router (for example, have "tampa" as the default router, which includes both the Share-A-Bull GBFS feed and Coast Bikeshare GBFS feed)? If so, the same above design in OBA used for trip planning should work fine for bikeshare - we'll just make the assumption for now that the default router can be configured for all GBFS feeds for the OBA region. If we can't configure OTP to consume more than one GBFS feed per router, then we'll need to change the design of the OBA Regions API to provide more information related to router_ids - perhaps a list of valid router_ids for the region that have GBFS feeds. |
I don't know at this moment. I will have to check it or ask someone who
knows OTP better. Let me get back to this once I complete displaying the
bike information on the map. Is that alright?
|
Sure, that's fine.
|
@carvalhorr Glad you got this working! Looks like all the mechanics are in place. Docker image for OTP would be great - do you have a Windows environment to test this in? For some reason I've had issues with Docker images created in Linux and running them on my Windows machine. |
As far as the layer UI, I think the bikeshare layer control would fit better outside of the navigation drawer. When tapped, it would expand to show a picture and text for each layer, like this animation from the Material design - Components - Buttons: Floating Action Button -> Speel dial example: For now this would just contain the bike image and text (and maybe a toggle control like a checkbox or swtich to turn on/off?), but in the future we could add Uber, Lyft, etc. Unfortunately I don't know if code to actually implement this already exists in a format we can use - I would hope it's in the Android support library or another open-source Google project. You might need to do some digging around. Here's the link to the material design layers image: |
Cool. I'll take a look at how to implement this. The bike option in the
drawer like I implemented did not feel right. This is why I want to create
the docker so that others can see how it is progressing and give feedback.
Should the bus stops also have an option to switch on/off?
As for the transition, do you prefer this one that you showed or the
toolbar (I could not find a gif for it, but take a look here
<https://material.io/guidelines/components/buttons-floating-action-button.html#buttons-floating-action-button-transitions>,
under "Transitons" there is an option "Toolbar")?
P.S.: I don't have a windows machine to create the docker image. I was
thinking about deploying it to some cloud service and you and the others
can point to it and test.
…On Fri, 16 Jun 2017 at 21:59 Sean Barbeau ***@***.***> wrote:
As far as the layer UI, I think the bikeshare layer control would fit
better outside of the navigation drawer.
For the general map layer control (which would include bikeshare for now,
potentially others in the future), I had in mind another action button
above the "My location" button - something like this:
[image: image]
<https://user-images.githubusercontent.com/928045/27244309-f8d7dc5e-52b3-11e7-9ef4-d940573e4884.png>
When tapped, it would expand to show a picture and text for each layer,
like this animation from the Material design - Components - Buttons:
Floating Action Button -> Speel dial
<https://material.io/guidelines/components/buttons-floating-action-button.html#buttons-floating-action-button-transitions>
example:
[image: components-buttons-fab-transition_card_02-small]
<https://user-images.githubusercontent.com/928045/27244549-096664fe-52b5-11e7-9774-d806f5ecb1a2.gif>
For now this would just contain the bike image and text, but in the future
we could add Uber, Lyft, etc.
Unfortunately I don't know if code to actually implement this exists - I
would hope it's in the Android support library or another open-source
Google project. You might need to do some digging around.
Here's the link to the material design layers image:
https://material.io/icons/#ic_layers
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#402 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADr1j1LJLHQI9DsgYstLp4LANWug3BkMks5sEuy2gaJpZM4Gu-3A>
.
|
BTW, great work on this so far! I think I forgot to say that earlier :).
Good question. Let's leave them on by default for now, it will make the initial implementation simpler. Although internally, as I previously mentioned, I do want to move towards a controller/loader structure that would allow us to turn stops and routes (including more than one route) on and off programmatically independent of one another. This would be needed to make them a separate UI layer in this control. Ultimately I'd like a Nearby routes/stops toggle option, possible controlled from a different UI control (maybe tabs-ish at the top or bottom of screen - more at #352). Internal controller/loader would need to be modified for that too. So I think the internal code is something we need to eventually tackle, although I'm ok leaving the bus stops off this particular map layer control.
I did see this toolbar option, and I think its the other potential candidate along with the speed dial example. I think the main limitation to the toolbar is that it doesn't allow text + images and you're limited to five items (the screen isn't wide enough for either), and I think it would look strange above the My Location button - we'd need to put it at the bottom of the screen and the My Location button above it (not a big problem, but a consideration). The advantage to the toolbar over speed dial is that it keeps all options near the bottom of the screen near your thumb - the speed dial would get harder to reach with the more items we add. I think I was leaning ultimately towards the speed dial option due to allowing text + images, and allowing potentially more items in the list. Some layers may not be obvious from an image alone, and in my experience you always end up with more map layers than you think you will.
That would work - I also need to figure out the Windows Docker issue, so I'll take some time to try and spin it up myself too. |
@carvalhorr I'm not sure if this fixed the issue? On a clean install after the above commit it seems like bikeshare markers never appear, even if I toggle the layer on and off, and exit and re-enter the app. |
Ah, sorry - I forgot to add the custom OTP URL :(. My fault. Looks like carvalhorr/onebusaway-android@b0a698f did indeed fix the problem. |
Regions API URL changed in commit carvalhorr@736fb11 |
|
Fixed in commit carvalhorr@44a8e95 |
Commit carvalhorr@80c9ba9 included bikeshare by default when planning a trip in a region that bike is supported |
|
Resolved in commit carvalhorr@8f38538
Both items resolved in commit carvalhorr@f79dccd |
The custom OTP url is saved when switching regions both on the |
Issue resolved in commit carvalhorr@93402db The same behavior will apply in HomeActivity. If a user clicks on a bike marker while viewing the bus stop info (on the sliding panel), the bus info will continue on the screen along with the bike station balloon. This seems to be more consistent with the behavior when showing the route on map. |
|
|
@carvalhorr What would you think of making the small bikeshare markers at more zoomed-out levels a little smaller? On the left below is the currently size of |
I could not find a solution in which the screen would return displaying the layers FAB in the same state (speed dial open), so I closed the speed dial when the activity's onStop method. This way when the user returns to the app, the FAB is closed. |
|
The first issue is fixed by commit 92bc1be I could not reproduce the second one. |
Did you try reproducing the second one via the emulator with a Tampa
location?
The commit you just added may fix this too.
I think this reverts the commit that fixed the "Issue fixed: layers FAB not
hidden when switching to "Starred stops" problem - do you if after the above it's happening again now?
…On Aug 20, 2017 10:34 AM, "Rodrigo" ***@***.***> wrote:
- - As of 2a88d4d
<2a88d4d>,
if you uninstall the app, and then re-install and run, and you're located
in Tampa, the Layer FAB does not appear on the first execution after
installation (I'm assuming that the regions callback isn't correctly
triggering the control to appear). If you close the app and restart it,
then the Layer FAB appears.
- - Similarly, if you have a region selected that doesn't support
bikeshare (e.g., Washington D.C.), and you change to Tampa (which does
support bikeshare), the Layer FAB doesn't appear (although if you have
Tampa selected, and switch to Washington D.C., the Layer FAB does correctly
disappear).
The first issue is fixed by commit 92bc1be
<92bc1be>
I could not reproduce the second one.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#402 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4pLZ_AAVngaElK8f5PtMVMPcl1XINcks5saEPagaJpZM4Gu-3A>
.
|
I tried to reproduce it using my device with the location set to Tampa. Apparently, the fix solves this problem too. The commit carvalhorr@802680f should make it work properly now for all the interactions:
|
@carvalhorr Awesome, thanks! I'll check it out.
|
|
|
|
Fixed in commit carvalhorr@551c71a |
Fixed in commit carvalhorr@c0d50df |
There is now a General Bikeshare Feed Specification (GBFS):
https://groups.google.com/forum/#!topic/transit-developers/Mhf8pmw9WTU
Official spec yet to be published. We should look at supporting this in OBA - I think this is a client-side issue, although we may need a new set of fields in the Regions API that define the bikeshare API endpoints for a region.
See related issue for OTP:
opentripplanner/OpenTripPlanner#2181
From that issue:
The text was updated successfully, but these errors were encountered: