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

Fix #209 #210

Merged
merged 2 commits into from
Aug 31, 2023
Merged

Conversation

smellyshovel
Copy link
Collaborator

The solution briefly:

In order to build the polyline features used to render the lines on the map, we can't take the full resulting geometry, because we need to be able to highlight individual route legs when those are hovered. In order to build the legs, we first first decode the final routeline to get a list of individual coordinates through which the lines go and then compare the coordinates with the snappoints' coordinates. When there's a match, we "break" the route line into 2 individual route legs.

There was a bug, that when looking for coordinates that are the same (snappoint's coordinate the same as the current routeline's coordinate), we started the search everytime from the beginning of the route's coordinates. Therefore, for different snappoints with the same location, we took the same "portion" of a routeline, creating a total mess on the map. This fix changes the algorithm to search for the next snappoint from the index where the last search succeeded.

This PR closes #209

@smellyshovel smellyshovel added bug Something isn't working semver:patch For non-breaking PR's that don't introduce new features labels Aug 31, 2023
@smellyshovel
Copy link
Collaborator Author

One day we'll cover that logic with tests... Though not this time :)

@smellyshovel smellyshovel merged commit 9dffcea into maplibre:main Aug 31, 2023
2 checks passed
@smellyshovel smellyshovel deleted the fix-broken-build-routelines branch August 31, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semver:patch For non-breaking PR's that don't introduce new features
Projects
None yet
2 participants