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

Question regarding RoutingDatabase::GetRouteNodes() #1502

Closed
frank-aurich opened this issue Sep 18, 2023 · 2 comments
Closed

Question regarding RoutingDatabase::GetRouteNodes() #1502

frank-aurich opened this issue Sep 18, 2023 · 2 comments
Labels
question For issues of type 'question' routing For routing issues

Comments

@frank-aurich
Copy link
Contributor

Hi,

I have a question regarding the function RoutingDatabase::GetRouteNodes().
The function expects a start and end iterator for node IDs, a size value stating the number of nodes, and a vector (or unordered_map) for the results.

I wanted to use the function to determine all RouteNodes of a way, by passing the proper iterators way->nodes.cbegin()/way->nodes.cend().
But I discovered, that the function returns as soon as there's a node that is not a RouteNote:
https://github.com/Framstag/libosmscout/blob/master/libosmscout/include/osmscout/routing/RouteNodeDataFile.h#L121

I'd like to know: Is that behavior by design? What purpose are the passing of iterators, if one won't be able to query all RouteNodes of the input list?

@Framstag
Copy link
Owner

See implementation in RouteNodeDataFile.h The code expect the ids to get resolved sucessfully, else loop will stop. So your analysis is correct. This method is (indirectly) called from the routing engine, where we are safe that the routing graph only contains correct routing ids (See RouteNode, which besides other attributes has a list of paths that end in a new route node). These are optimized mass operations. If you want to check, if a node is a route node you have to call GetRouteNode and check the result. See for example bool AbstractRoutingService::GetWayStartNodes(...)

@Framstag Framstag added question For issues of type 'question' routing For routing issues labels Sep 19, 2023
@frank-aurich
Copy link
Contributor Author

Thanks for the explanation. Using GetRouteNode() on single nodes will suffice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question For issues of type 'question' routing For routing issues
Projects
None yet
Development

No branches or pull requests

2 participants