Duplicate x1,y1,x2,y2

I’m creating a graph in Java using OSM {x1, x2, y1, y2} data from my PostgreSQL database and I’m having a problem dealing with duplicates. The image below shows an example of this problem, where there are 3 different ways to get to the same source-target. At the moment I can disambiguate using the costs, but I need more information to get directions.

I want to be able to tell a user “go-left/right/straight”, but I don’t know where this data is. For example, in the image, if I’m travelling from right to left, I need information from the top path to say “right” on Rue de Carillon. I hope this makes sense. Any help is appreciated.

The data “left/right/…” is not in the database. You will have to calculate that yourself based on the direction you are coming from and the direction you are heading towards. You will have to compare the coordinates and the direction to decide what is left/right/…

What escada said. :slight_smile: Also, if you find that your PostgreSQL database lacks the necessary information (e.g. because it only has a pure graph representation or pairs of coordinates), you need to look into changing the schema and/or import logic. OpenStreetMap data itself certainly contains the necessary information (way geometries) to calculate this information.

Thanks for the input. It sounds like I have quite a bit more work ahead of me. From what you’re saying I think changing the schema is probably the way to go.