nilsnolde / valhalla-app

This is the demo web app running on https://valhalla.openstreetmap.de
https://valhalla.openstreetmap.de
MIT License
164 stars 92 forks source link

Alternative routes #33

Closed nilsnolde closed 3 months ago

nilsnolde commented 1 year ago

why not..

georg-d commented 1 year ago

Ideas

nilsnolde commented 1 year ago

Ah no sorry, "alternative routes" is a fairly established term, same as the OSRM frontend or Google Maps, where you get 1-2 alternatives for the cheapest route, which are slightly worse routes but significantly different in their path (as to count as real alternatives), and most importantly have the exact same constraints as the cheapest route.

What you're describing is routing based on personal preferences and is smth anyone can do already with all the costing options on the right side. However, Valhalla does actually lack quite a few pedestrian things we could add, e.g. lit as you mentioned. Let's turn that into a Valhalla issue, I'll tag you there, maybe you have some more ideas around pedestrian routing.

georg-d commented 1 year ago

@nilsnolde I had exactly in mind what you describe. In order to offer multiple alternatives, the optimizer needs to provide different results which will only happen with more or less big variances in the optimaziation goals.

What did you think of as variations to offer alternatives? 🙂

I came from the view point of usefulness for users 🙂 By letting the system pro-actively offering alternatives with quite different goals/characteristics, users are saved from the effort to go through the settings (how many end users do even know about the seetings and also know how to configure the system to get a route with certain characteristic?). Explicitly naming alternatives "short" or "simple navigation" or "greener" helps users to quickly get the characteristic of each alternative without need to look into the details of the alternatives. The overall goal was users are allowed to choose the most appropriate/useful alternative more quickly. Thank you for opening https://github.com/valhalla/valhalla/discussions/3838 which is of courese a pre-requisite for the idea and helpful for several other uses as well!

nilsnolde commented 1 year ago

I had exactly in mind what you describe. In order to offer multiple alternatives, the optimizer needs to provide different results

Hmm, that's not really what I had in mind ;) You're really talking about entire different routes. Alternative routes work differently: the routing still only happens once, but out of the whole expansion you select more than one possible path. That of course has the same costing options/settings as the main/cheapest route.

What you're proposing is more like having named/managed pre-sets of combinations of certain costing options/settings, on top of the detailed costing option view. That could be fairly easily done, probably easier than what I have in mind even. Just a couple of buttons shortcutting detailed options. Still, I wouldn't like that one push of a button sends more than 1 request, even though I understand that you'd like all different routes displayed next to each other. That's much more effort but can be tackled separately at a later point if there's enough interest.

This repo is not really meant to be a functional routing app, no one is funding this effort. We might take it there along the way, but I can't guarantee anything at this point. Other than being open for PRs and contributions by the community. I'd rather have a proper routing & navigation SDK based on Valhalla that can be integrated into maplibre, iOS/Android, rather than doing these silo projects.

georg-d commented 1 year ago

the routing still only happens once, but out of the whole expansion you select more than one possible path. That of course has the same costing options/settings as the main/cheapest route.

As your idea is to show alternatives based on the exact same opimization goals/settings, what would then be the criterion(s) to select the 2-4 alternatives out of thousands of possible paths? 🙂 I really have difficulties imagining it that way. For example, simply using the path with 2nd lowest cost will usually not produce a "real" alternative because just a tiny fraction of the route will differ. But "real" alternatives like e.g. the shortest, the quickest, the cheapest (think toll and gasoline), and the best combination of short & quick & cheap would in the end be different optimization goals.

What you're proposing is more like having named/managed pre-sets of combinations of certain costing options/settings, on top of the detailed costing option view.

Hm. I did not think it that way, but you're right: What I suggested is like like "setting profiles" – just that the system pro-actively suggests several of them to the user instead the user needing to tell the system and try one "setting profile" after the other.

This repo is not really meant to be a functional routing app, no one is funding this effort. We might take it there along the way, but I can't guarantee anything at this point.

No guarantee and being open for PRs & contributions are pretty much expected by me 😉 The rest seems a dedicated topic on itself thus I moved it out of this issue to https://github.com/gis-ops/valhalla-app/discussions/43

nilsnolde commented 1 year ago

I really have difficulties imagining it that way.

Look at Google Maps, they do exactly that. "Real" alternatives are routes that significantly differ in path (like max 50% shared with the cheapest and other alternatives or so) but not too much in cost/ETA.

georg-d commented 1 year ago

I did look at GM. For cars, their alternatives are real alternatives and useful, especially on longer distances. But for pedestrians and cyclists, GM is IMHO mainly an inspiration what not to do: The alternatives do often seem to be shown just to show alternatives, but they are no "real" alternatives in my eyes because they are often identical in more than 50% of the total distance and often offer no different qualities/characteristics. Quite often, GM seems to favor major streets and set no considerable penalty for longer routes – as if pedestrians were cars (with cars, wide streets are more convenient and often also faster despite longer absolute distance); Valhalla seems to have a similar but less strong bias which I was not able to invert to the opposite with all settings I tried, while OsmAnd is less biased in that respect. For cycling routes, GM vastly ignores any infrastructure that is of relevance to cyclists; Valhalla and OsmAnd are much better.

Examples that may serve as test objects during implementation of alternatives:

nilsnolde commented 1 year ago

But for pedestrians and cyclists, GM is IMHO mainly an inspiration what not to do:

Haha, fair enough. That’s true, and probably mostly coming from the fact that ped/bike don’t go very far and usually drive the same speed on almost all road types (at least less pronounced differences). Think I understand better now what you’re saying. My takeaway for now is that classic alternatives are mostly useless for bike/ped. Anything going in your desired direction would use much more resources though as we’re talking multiple requests with different properties.

Your last example is a bit scary hahaha that’s ending (or starting) LITERALLY 50 m from my home😂

harsh5902 commented 1 year ago

i don't know how much practical it is but I thought would be good to share this idea- of alternative routes based on low carbon footprint for the vehicles. How does that sound @nilsnolde Just a random idea came to mind so thought worth sharing and get some opinion.

nilsnolde commented 1 year ago

low carbon footprint for the vehicles

That's a HUGE feature. To do this properly, you'd need to know the detailed properties of the exact car to model fuel usage along differently parameterized road segments. And that's only petrol cars. With EV one enters a whole other world where there's not only discharge but also recuperation processes, i.e. the battery recharges while driving.

So, it's not smth for this repo, this belongs upstream to https://github.com/valhalla/valhalla.

FWIW, the way GM does this is crap and not even worth the feature IMO.

harsh5902 commented 1 year ago

That's a HUGE feature. To do this properly, you'd need to know the detailed properties of the exact car to model fuel usage along differently parameterized road segments. And that's only petrol cars. With EV one enters a whole other world where there's not only discharge but also recuperation processes, i.e. the battery recharges while driving.

ohhh, that's much bigger than I thought.😅

nilsnolde commented 1 year ago

To do it properly, yes. Or half-ass it like Google Maps and (almost) all others.