Skip to content
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

Bus stop routes overview: colours distinguishing up/downroute #64

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

emer7
Copy link

@emer7 emer7 commented Jan 25, 2022

Fix #47

  • Add .prettierrc so I don't overwrite / format all the existing files πŸ˜…
  • Implement different color for up/down-route

Currently the implementation is as follow:

  • For ⇄ and β†’ route, check direction and assign color accordingly to different direction
  • For ⟲ route, is it a even-numbered or odd-numbered loop route?
    • If it is odd-numbered (i.e. hasMidStop)
      1. Get coordinate for midStop
      2. Find the interpolation of midStop coordinate to the loop
      3. Color the route accordingly up to the interpolatedCoordinate
    • If it is even-numbered (i.e. !hasMidStop)
      1. Get coordinates for 2 stops: lastStopOfFirstHalfOfLoop and firstStopOfSecondHalfOfLoop
      2. Get the segment of the loop that approximates closest to those 2 stops coordinates
      3. Get the middle point of the said segment
      4. Color the route accordingly up to the middle point

This feature removes color gradient for route colouring due to Mapbox's line-gradient not able to accept data-driven property mapbox/mapbox-gl-js#8977

Photos:
image
image

@emer7
Copy link
Author

emer7 commented Jan 27, 2022

@cheeaun ready for review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bus stop routes overview: colours distinguishing up/downroute
1 participant