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

Only allow route to contain one street #44

Open
ethndotsh opened this issue Nov 27, 2023 · 5 comments
Open

Only allow route to contain one street #44

ethndotsh opened this issue Nov 27, 2023 · 5 comments

Comments

@ethndotsh
Copy link

I am working on an AI traffic throughput app and need to have some way to select what road I am solving for.

Is there a way that already exists or a simple change in the lib I can make to only allow another point to be placed if the road or street is the same as the last point?

@dabreegster
Copy link
Owner

Interesting use case! It sounds like a pretty straightforward change:

  1. Plumb through a new boolean in Config, following the example of avoid_doubling_back
  2. Implement it near
    // Penalize visiting edges we've been to before, so that waypoints don't cause us to double
    . When the config is true and prev_path has at least one edge with a name, then either set a huge penalty for every edge not matching that name, or create a totally new DiGraphMap subsetted to appropriate edges. The first option would make sense if you want the requirement to be best-effort, which could make sense depending on how OSM ways are split and named.

If you notice any performance degradation for this, then we could think about caching the avoid set or the subsetted graph.

Would you be up for sending a PR?

@dabreegster
Copy link
Owner

A more complex way to think about this could be to minimize the number of road name changes along the path. I'm thinking about an example in Seattle that I just think of as 23rd Ave (or... maybe 24th). I'm pretty sure people would colloquially agree it's the same road, but it has a bunch of name changes:

@ethndotsh
Copy link
Author

A more complex way to think about this could be to minimize the number of road name changes along the path. I'm thinking about an example in Seattle that I just think of as 23rd Ave (or... maybe 24th). I'm pretty sure people would colloquially agree it's the same road, but it has a bunch of name changes:

Interesting... How would you suggest we accomplish that?

@dabreegster
Copy link
Owner

Not sure. If we were only appending points to the end of the route, it'd be similar to the above logic, picking the preferred road name from the end of prev_path. But dragging points around in the middle isn't easy to detect from the individual calls to pathfind; those calls are triggered by actions like dragging, but indirectly.

@andrewn6
Copy link

I can take this on

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

No branches or pull requests

3 participants