-
Notifications
You must be signed in to change notification settings - Fork 1
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 color-coded routes and extremely basic route and station tooltips to map #103
Conversation
Some notes: -Routes have a tooltip that displays on-click, showing the route's long name. -Colors are as-is (CTA bus routes are gray, Portland bus routes are dark bluish/purplish, New York's bus and subway routes are a wild mixture of colors, which we might want to set to a more neutral tone). -Metra routes are not showing up at all (and thus have no color); investigate whether this is a data ingestion issue, a validation issue (such as the color column needing .strip() to be 6 characters long for hex code), or something else such as a non-standard column name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking very cool so far, thanks Matt!
# work with it. | ||
# to serialize into GeoJson, need to get out entire Django model object, not just | ||
# the .values("geo_representation", "route_name", "color") | ||
# with .values() you get "AttributeError: 'dict' has no component 'meta'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great note, do you notice slowness from loading all of these routes? If so maybe this is a candidate for caching since this data will generally not be changing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this out and it took about a minute to load the chicago page the first time, we may need to look into ways to cache, or auto-load on initialization, or only load some layers at once to reduce how much is being pulled in at a time (but this can be a ticket for later).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took a minute or two for me to load too. I'm also wondering if splitting this into two functions may be better the pins need to be dynamically loaded and the routes don't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, it's taking maybe 30-45 seconds to load and this is probably why. Agree that refactoring to speed it up should be its own ticket
app/route_rangers_api/views.py
Outdated
) | ||
|
||
# stations | ||
stations = TransitStation.objects.values().filter( | ||
city=CITY_CONTEXT[city]["DB_Name"] | ||
) | ||
lst_coords = [[point["location"].x, point["location"].y] for point in stations] | ||
# print(stations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need print statements in production if I am reading this correctly (line 58 as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deleted in new commit
@mbjackson-capp look great! I wonder if we could lower the opacity of the colors to help with overlapping routes and making it less overwhelming |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool!
# work with it. | ||
# to serialize into GeoJson, need to get out entire Django model object, not just | ||
# the .values("geo_representation", "route_name", "color") | ||
# with .values() you get "AttributeError: 'dict' has no component 'meta'" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This took a minute or two for me to load too. I'm also wondering if splitting this into two functions may be better the pins need to be dynamically loaded and the routes don't.
Resolves #84 . Gets the basics of #89 (which still need to be built out to include route information, ridership data if available, etc.)
Screenshots:
As of now, line names display when clicking on a transit line, and station names display when hovering over a station icon (at low enough zoom level, once cluster has fully declustered). Note that even for bus lines typically referred to by a number (as in Chicago's CTA) it displays the text name, not the number, of the route:
.
The New York colors are wild!! We should look into whether these are substantively meaningful for buses and, if not, consider hard-coding over bus lines to be a more neutral color distinguished from the subway lines:
.
We're having some display issues with Metra, which is not showing at all. (The other notable commuter rail line in our trial cities, the WES Commuter Rail, is displaying properly without issue on the Portland map.) TODO: Investigate what's going on (hypotheses: extra whitespace in the color strings, column names are slightly different so color column isn't read in)
Also still TODO: figure out how to display overlapping lines side-by-side, which isn't implemented yet.