-
Notifications
You must be signed in to change notification settings - Fork 224
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
bugfix and simpler code #203
Conversation
Thanks @rikojacob! Can you also provide a test? For example use one of the provided test tracks, loop through points and make sure PS. Don't worry about |
Done, slightly differently, including some tests if None is handled as expected. |
Now everything is based on walk(), no test fails, no type errors in new code. Two more general comments: Perhaps it would make sense to change NearestLocationData to LocationData and make it the type of elements walk() returns |
Merged, thanks! |
The original code of get_nearest_location(location) has the property that if 'location' is a point on the track, the point after 'location' on the track is returned (for that case 'not distance' is True because distance is 0.0).
There is a version that only adjusts for this behavior in the middle commit.
I consider the version using min(..,key=lambda ..) even more readable.
One could consider this a hotfix, so perhaps it should be a pull request on master. If you prefer this, I can prepare such a pull request. (I'll have to do it from a different fork because this one has the full merge of dev...)