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

Proposal: I KNOW HOW TO IMPLEMENT ROUTES* #38

Open
keokilee opened this issue May 26, 2015 · 1 comment
Open

Proposal: I KNOW HOW TO IMPLEMENT ROUTES* #38

keokilee opened this issue May 26, 2015 · 1 comment
Labels

Comments

@keokilee
Copy link
Member

*kinda

Background

At Reboot the Commute, @ryankanno wanted to use the API to report incidents between two zip codes. I convinced him that what you really want is routes, because someone's not going to care about accidents that happen on a side street. He said, "Oh, never mind then. I'll just demo it saying it goes from Hawaii Kai to town and it'll report incidents along Kalanianaole Highway between 3 and 5 PM".

This lead me to an epiphany. Take this example from goakamai.org.

screen shot 2015-05-25 at 9 37 36 pm

You've probably seen something similar many times on TV. What's really interesting is what's not on it. It only maps out the main arteries on the island, and we're on a pretty small island. So, why don't we only map out incidents along certain roads? Yes, some people will care about "the last mile", but everybody will care about incidents on the major roads they take to work.

Proposal

Let's start with neighboring areas. If the user's route is from Mililani to Waipahu (or vice versa), the user cares about incidents along H3 and incidents along a certain segment of Kamehameha Highway. We have the address and exit information, so we can figure this out. Now let's say the person is going from Waipahu to Pearl City. We would then look at incidents that happen along a certain segment of Kamehameha Highway and a certain segment of H1 (H1/H2 merge to Kaonohi Overpass). If the user goes from Mililani to Pearl City, we can combine the two.

So, more abstractly, we can start creating points that represent areas and then draw lines between each area's immediate neighbor. Each line represents the segments of major roads that we care about. The slightly tricky part is figuring out what's the shortest path in miles is between two areas. If you have a CS background, this sounds really familiar to you. For the rest of you, see Dijkstra's Algorithm.

Feedback

This isn't perfect and we'd probably have to make decisions for corner cases (Waimanalo to town, do you go through Hawaii Kai or go through Kailua?). I'm also thinking that this should be part of hitraffic/api-server. I'm only putting it here because the mobile team in February expressed interest in solving this problem. Let me know if this proposal makes sense. It's a challenging problem that requires actual computer science (gasp), but it'll also make the app complete.

@hitraffic/members, thoughts?

@ryankanno
Copy link

While I'm not entirely sure what this app is doing - I think what might have been missed is that we solved this problem by decoding the polyline of the actual route and using a spatial query with a tiny radius - which seems to work out pretty well for our use case. I'm not sure if it's the same as this, though. :)

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

No branches or pull requests

2 participants