mapzen / eraser-map

Privacy-focused mapping application for Android
GNU General Public License v3.0
75 stars 24 forks source link

White transit line not visible on map #810

Closed ecgreb closed 7 years ago

ecgreb commented 7 years ago

At first glance it appears the tram leg is not drawn.

multimodal-1

However zooming in reveals the line is drawn but it is white.

multimodal-2

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]

"travel_type": "tram",
"travel_mode": "transit",
"arrive_instruction": "Arrive: 12:00 AM at Asemapäällikönkatu.",
"verbal_pre_transition_instruction": "Take the 9 toward Pasila.",
"verbal_post_transition_instruction": "Travel 7 stops.",
"instruction": "Take the 9 toward Pasila. (7 stops)",
"time": 681,
"type": 30,
"verbal_depart_instruction": "Depart at 12:00 AM from Kaarlenkatu.",
"length": 1.066,
"transit_info": {
  "operator_name": "HSL",
  "transit_stops": [{
                      "lon": 24.951485,
                      "type": "station",
                      "onestop_id": "s-ud9wru917e-kaarlenkatu",
                      "name": "Kaarlenkatu",
                      "lat": 60.186085,
                      "departure_date_time": "2016-12-20T19:1602:00"
                    }, {
                    // ...
                    }, {
                      "lon": 24.940496,
                      "lat": 60.198242,
                      "arrival_date_time": "2016-12-20T19:2402:00",
                      "type": "station",
                      "onestop_id": "s-ud9wrwc05t-asemapäällikönkatu",
                      "name": "Asemapäällikönkatu"
                    }],
  "operator_onestop_id": "o-ud9-helsinginseudunliikenne",
  "text_color": 0,
  "color": 16777215,
  "onestop_id": "r-ud9wr-9",
  "operator_url": "http:\/\/www.hsl.fi\/",
  "short_name": "9",
  "long_name": "Länsiterminaali-Rautatieasema-Pasila",
  "headsign": "Pasila"
},

The decimal value for "color" 16777215, translates to #FFFFFF hexidecimal color value.

ecgreb commented 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?

dgearhart commented 7 years ago

@ecgreb the color values come from transitland @gknisely are the defaults for line color and text color white and black respectively?

gknisely commented 7 years ago

Yes. These are the defaults as described in the gtfs spec. https://developers.google.com/transit/gtfs/reference/routes-file @ecgreb @dgearhart

ecgreb commented 7 years ago

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.

tuukka commented 7 years ago

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.

drewda commented 7 years ago

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:

ecgreb commented 7 years ago

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.

matteblair commented 7 years ago

Tangram-es supports styling polylines with "outlines", so that's a possibility. The question remains whether that is the most desirable option, visually.

sarahsnow1 commented 7 years ago

Closing in favor of https://github.com/transitland/transitland/issues/255, https://github.com/mapzen/eraser-map/issues/823