Closed ecgreb closed 7 years ago
After further investigation it seems white is not the correct color for the HSL transit line.
Here is official documentation for HSL colors and implementation in Digitransit UI app provided by @tuukka (thanks!)
@dgearhart @drewda do we know where the color value is coming from in the response? Do we have incorrect data for HSL or is white the default value?
@ecgreb the color values come from transitland @gknisely are the defaults for line color and text color white and black respectively?
Yes. These are the defaults as described in the gtfs spec. https://developers.google.com/transit/gtfs/reference/routes-file @ecgreb @dgearhart
This seems less than ideal for our use case given the roads in bubble wrap are also white. Is it possible for us to change the default color in our implementation? cc @drewda
This is also something we could handle on the client side if updating the service is not a good option.
I think Transitland shouldn't provide a color if none is specified in the source data. Otherwise, you don't know on the client side if a line is meant to be white or default color.
FYI, here's the data that Transitland has about the route used in that particular Valhalla response:
https://transit.land/api/v1/routes/r-ud9wr-9
{
"identifiers":[
"gtfs://f-ud9-helsinginseudunliikenne/r/1009"
],
"imported_from_feeds":[
{
"feed_onestop_id":"f-ud9-helsinginseudunliikenne",
"feed_version_sha1":"6f35eb7257af44b66838bb46d4b2286231df48bf",
"gtfs_id":null
}
],
"created_or_updated_in_changeset_id":3590,
"onestop_id":"r-ud9wr-9",
"name":"9",
"vehicle_type":"tram",
"geometry":{
...
},
"color":null,
"tags":{
"route_url":"http://aikataulut.hsl.fi/linjat/fi/h9.html",
"route_long_name":"Länsiterminaali-Rautatieasema-Pasila"
},
"stops_served_by_route":[
...
],
"operated_by_onestop_id":"o-ud9-helsinginseudunliikenne",
"operated_by_name":"Helsingin seudun liikenne",
"wheelchair_accessible":"all_trips",
"bikes_allowed":"no_trips",
"created_at":"2016-12-10T02:52:14.883Z",
"updated_at":"2016-12-10T02:52:14.883Z",
"route_stop_patterns_by_onestop_id":[
"r-ud9wr-9-242590-40454a",
"r-ud9wr-9-301a50-721b34",
"r-ud9wr-9-057a81-ced6e8",
"r-ud9wr-9-d72931-59b6f5",
"r-ud9wr-9-104312-33c0fd",
"r-ud9wr-9-bae833-0726ef"
]
}
Note that "color":null
because the source didn't specify a color.
When Valhalla fetches data from Transitland, it sets a default route color of white (https://github.com/valhalla/mjolnir/blob/04568ec48f9404ba1c459a24002ac55351cce26d/src/mjolnir/valhalla_build_transit.cc#L339).
A few options:
Transitland accepts edits. If @tuukka or anyone else would like to set colors for some of these routes in Helsinki, I'd be glad to provide information on how to do this.
In our web demo of Turn-by-Turn multimodal routing, we intentionally added an outside stroke on route lines to handle white segments. For example: https://mapzen.com/products/turn-by-turn/?d=0&lat=40.7259&lng=-73.9805&z=12&c=multimodal&st_lat=37.839682&st_lng=-122.485284&st=Vista%20Point&end_lat=37.80927&end_lng=-122.25981&end=Fairyland&use_bus=0.5&use_rail=0.6&use_transfers=0.4&dt=2017-01-10T08%3A00&dt_type=1 @ecgreb: a style addition to consider for mobile rendering?
Alternatively, Eraser Map is free to override any white route color response and set it to a better color option to display on top of the basemap style you all are using.
And finally, @gknisely and I have discussed whether it would make sense to remove the white default value from Valhalla and return a null value in the routing response. This would leave full responsibility to clients to set a default line color. This may be the cleanest option in the long run, but before making changes to Valhalla's internal defaults we would need to check for implications in web clients (like leaflet-lrm) and other mobile clients.
Thanks for the info @drewda.
I don't hate the idea of Valhalla returning null
when the route line color is not specified that would allow us to distinguish between "no color available" and an actual white transit line (if this exists) so we don't override valid data with a local default color. I also realize why this is not a trivial change when you have to consider existing clients.
As for adding the visual outline this would require updates to the stylesheet and possibly Tangram ES so would require some coordination across teams to implement on mobile but could also be a reasonable option. I would be interested to get thoughts from @nvkelso and @matteblair on this approach.
Tangram-es supports styling polylines with "outlines", so that's a possibility. The question remains whether that is the most desirable option, visually.
At first glance it appears the tram leg is not drawn.
However zooming in reveals the line is drawn but it is white.
The JSON response confirms the white color for the tram line.
https://valhalla.mapzen.com/route?json={"costing":"multimodal","directions_options":{"language":"en-US","units":"miles"},"locations":[{"heading":"0","lat":"60.1846","lon":"24.9485"},{"city":"Helsinki","lat":"60.199102","lon":"24.940497","name":"HSL","state":"Uusimaa","street":"HSL"}]}&api_key=[YOUR_API_KEY]
The decimal value for "color"
16777215
, translates to#FFFFFF
hexidecimal color value.