I am preparing a routing function with pgrouting with the travel model in public transport (bus).

I already have all the stops related to the table of ways (downloaded by osm2pgrouting) I have my table with the stops and the source and target of the segment of the line in which they are.

But my question is how to prepare a query where you can find the closest stop at the beginning of the route and at the end of the route and also start at that stop that will be the closest and end at the stop closest to the destination.

The only thing I have achieved is to represent the bus route, going through all its stops, but of course, when I launch my query it represents the entire bus route, and I don't want that. As I said before, what I want is that the beginning and end of the route be the segment of the line where the stops are, but not that the entire bus line represents me.

closed as unclear what you're asking by TomazicM, Fran Raga, whyzar, Vince, LaughU Jul 31 at 7:56

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.