-
-
Notifications
You must be signed in to change notification settings - Fork 367
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
Refer to previous edges for cost function #1158
Comments
Nothing of the kind can be done with current pgRouting (nor in the near future) |
Would PostgreSQL's window functions help you out here? If you already have an ordered set of edges and their geometries, you can get the angle between the current and previous rows with something like this: ST_Angle(LAG(the_geom) OVER (), the_geom) You'd need to make sure that the edges themselves are in the correct order (i.e. the end point of the first edge is the start point of the second edge). |
maybe using trsp |
@flother That was a good hint, thanks. I tried that, first ordering the set of edges, then lagging -1 to calculate the angle. The following image shows the resulting route, the tiny numbers are the cost returned by Somehow lagging within the function does not yield the expected results. Thanks! |
Maybe another idea ... |
I could not find such a thing in the docs:
I want to calculate cost based on the previous edge (for instance, get the path with the least number of turns). Is there a way to do this currently?
Something along these lines:
Thanks,
The text was updated successfully, but these errors were encountered: