Save both forward and reverse datasources. #4352
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses #4346 where we were not correctly saving or retrieving both forward and reverse datasource attributes for road segments (roads can have data from different sources in different directions).
The basic summary is that we did not have separate storage for forward and reverse data - so we were randomly overwriting with whichever datasource was applied to the graph last. There was also an off-by-one bug that meant we were often seeing datasource values from other roads on the first/last segment of the road in question.
In the following two images, colours represent different sources of data:
Before this change, there was a lot of this going on:
After this change, the map is a lot more consistent, as expected:
NOTE: this doubles the amount of disk/RAM needed to store datasource IDs. The good news is that we only use
std::uint8_t
for each segment.I tested with
mexico-latest.osm.pbf
just to confirm, and the.geometry
file increased by the expected amount:before: 211,090,822
after: 223,418,490
% increase: ~5% (note this is just for this file, it's closer to 2% for the total dataset)
I would expect this to scale for the planet file as well.
NOTE 2: This PR changes the file format (we store more data now) - there's no way to backport this compatibly to 5.9.
Tasklist