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

Adding a weighted ShortestPath option #2564

Open
kauevestena opened this issue Jan 9, 2024 · 2 comments
Open

Adding a weighted ShortestPath option #2564

kauevestena opened this issue Jan 9, 2024 · 2 comments

Comments

@kauevestena
Copy link

Hello! First of all, congrats for the amazing project!

I found Turf on searching tools for an attempt to create a routing demo and host at github pages, having the computation running on client-side, I found that there's the function "ShortestPath", which would be an amazing beginning. But for my application I would rather have weighted routes, I even have the weights computed in a field of the geojson file.

So this is my suggestion/request,

Best Regards,
Kauê

@smallsaucepan smallsaucepan changed the title [Feature Request] Any chance of providing a Weighted ShortestPath? Adding a weighted ShortestPath module Jan 10, 2024
@smallsaucepan
Copy link
Member

Thanks for your suggestion @kauevestena. Do you think it needs to be an entirely new module? Or would it make sense to add some optional weighting parameters to the existing shortestPath call? For example, weight: number and the function uses that to compare if it exists?

@kauevestena
Copy link
Author

I think that the best option would be an optional argument (default null) in the function call.

It could be either an string referring to a precomputed field (less flexible), or to a function that could also calculate weights on-the-fly (could be less optimized).

@kauevestena kauevestena changed the title Adding a weighted ShortestPath module Adding a weighted ShortestPath option Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants