I have exported a map as OSM XML data. The nodes making up a way need to be ordered correctly for an application that I am building. In other words if I am traversing the way, the nodes need to be in the same order in the map data that they are in reality. The nodes in some of the ways in my XML data are ordered correctly, but others are not. Any ideas why?
If the latitude and/or longitude of each node making up a way always increase or decrease, simply sorting the data on latitude or longitude orders the nodes correctly, but quite obviously this does not always work. I can correct the incorrectly ordered nodes manually, but for a large map this will be incredibly time-consuming.