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

Not working when points are a collection of GPS positions (Bug of missing feature?) #1

Open
johnjore opened this issue Aug 9, 2024 · 2 comments

Comments

@johnjore
Copy link

johnjore commented Aug 9, 2024

Hi!

I tried to use this on a GPX track, substituting X & Y with lat & lng co-ordinates. I used a tolerance of 0.001 in this example.

This is a small section that's been "optimized":
Screenshot_20240809_185016_walkabout

Original:
Screenshot_20240809_185120_walkabout

For some reason, when it travels in a certain direction, it ends up being a straight line and unmodified in the other direction. The GPX went from 4699 points to 2778 points, but if tolerance value is increased, all it does is have more straight lines, and other areas still appear untouched.

My guess is that the code assumes points are "travelling" from left to right, like a graph, and not any random direction?

@BobLd
Copy link
Owner

BobLd commented Aug 9, 2024

@johnjore I wouldn't expect the ordering of the points to matter, so might be a bug in the code.

Maybe can you try this different implementation https://github.com/BobLd/PContourNet/blob/56255225aca740795ca2156c1ab3e5b6edd8ac56/PContourNet/PContour.cs#L484

I ported the code from another java implementation. In your case you will on care about the methods at the bottom.

@johnjore
Copy link
Author

johnjore commented Aug 9, 2024

Thanks for quick response. Suspect there is a bug in there then.

I found a different implementation a few min after posting, https://github.com/rohaanhamid/simplify-csharp, and it appears to work correctly on the same GPX.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants