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

costmatrix algorithm do not respect oneway on trivial routes #4538

Closed
radekvermirovsky opened this issue Jan 30, 2024 · 4 comments · Fixed by #4626 or #4633
Closed

costmatrix algorithm do not respect oneway on trivial routes #4538

radekvermirovsky opened this issue Jan 30, 2024 · 4 comments · Fixed by #4626 or #4633
Labels

Comments

@radekvermirovsky
Copy link

If we use this request to route endpoint:

{
	"locations": [
        {
		"lat": 50.22878,
		"lon": 15.83895
	},
        {
		"lat": 50.22888,
		"lon": 15.83918
	}
	],
       "verbose":false,
	"directions_type": "none",
	"costing": "auto",
	"prioritize_bidirectional": true
}

oneway is respected properly.
Foggis
https://valhalla.openstreetmap.de/directions?profile=car&wps=15.83895%2C50.22878%2C15.83918%2C50.22888
Polyline
https://valhalla.github.io/demos/polyline/?unescape=true&polyline6=true#qyux~Aguve%5DpUhx%40x%60%40%60uAjTiStQmQvQoQim%40smBu%40iC%7DSgu%40ox%40ju%40lDzL
Screenshot:
image

If we try find same route for matrix, using costmatrix algorithm:

{
	"sources": [
		{
			"lat": 50.22878,
			"lon": 15.83895
		}
	],
	"targets": [
		{
			"lat": 50.22888,
			"lon": 15.83918
		}
	],
	"verbose": false,
        "shape_format":"polyline6",
	"costing": "auto",
	"prioritize_bidirectional": true
}

response is:

{
    "algorithm": "costmatrix",
    "units": "kilometers",
    "sources_to_targets": {
        "shapes": [
            [
                "cyux~Aquve]wDyM"
            ]
        ],
        "durations": [
            [
                2
            ]
        ],
        "distances": [
            [
                0.020
            ]
        ]
    }
}

Polyline:
https://valhalla.github.io/demos/polyline/?unescape=true&polyline6=true#cyux~Aquve%5DwDyM
Screenshot:
image

@nilsnolde
Copy link
Member

I think this is a duplicate of #4433. I'm fairly sure bidir routing a* would have the same or a similar problem. For routing we use unidir a* for trivial routes (one edge), also because it's faster, but pretty sure also because there's problems with bidir algos if they start/end on the same edge. Of course we can't really do the same stratagy for matrix, we'd need to actually solve it. The route might be trivial, not sure the solution will be.

@nilsnolde
Copy link
Member

Actually I'll keep this open and close the other one, this has a test case

@nilsnolde nilsnolde reopened this Jan 30, 2024
@nilsnolde nilsnolde changed the title costmatrix algorithm do not respect oneway if source and target is close to each other costmatrix algorithm do not respect oneway on trivial routes Jan 30, 2024
@nilsnolde nilsnolde added the bug label Feb 4, 2024
@radekvermirovsky
Copy link
Author

radekvermirovsky commented Mar 15, 2024

We tested this, and indeed PR 4626 fixes this for values. Thank you for fixing this. Travel time and distance are now computed properly, respecting one-way restrictions in matrix computation. However, the polyline in the matrix return is not accurate. Looks like polyline generation in matrix cant handle this special oneway trivial route? It seems like the first segment is in the polyline in both directions, making it appear like a polygon rather than line with start and end, as in route computation.
image

@nilsnolde
Copy link
Member

Yeah seems it’s getting confused about the percent_along.. I’ll take a look later.

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