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

Warning - produces different result if coords are [x ,y, something] #64

Closed
rowanwins opened this issue May 6, 2020 · 2 comments · Fixed by #65
Closed

Warning - produces different result if coords are [x ,y, something] #64

rowanwins opened this issue May 6, 2020 · 2 comments · Fixed by #65

Comments

@rowanwins
Copy link
Contributor

I just ran a conversion using polyline.fromGeoJSON(feature) on some data and when I reconverted back to geojson using polyline.toGeoJSON(mPolyline) I got some weird results.

I dug into my source geojson then noticed it had [x, y, elevation] coordinates, so I trimmed to [x, y], and this produced the expected results.

I'd guess these lines are responsible
https://github.com/mapbox/polyline/blob/master/src/polyline.js#L109-L113

Anyway just a word of warning to others, check your inputs :)

@andrewharvey
Copy link
Collaborator

Yikes. There is also #43 which asks for 3d support, but since the resulting polyline encoding needs to know if it's 2d or 3d, I think it should be opt in and the default should be to ignore any extra coordinates, so consider the current behaviour a bug.

If you had a PR I can provide a second set of eyes to review and we can ping Tristen to try and get it merged, but if not that's fine also.

@rowanwins
Copy link
Contributor Author

rowanwins commented May 6, 2020

I'd guess these lines are responsible
https://github.com/mapbox/polyline/blob/master/src/polyline.js#L109-L113

Actually those lines aren't responsible I don't think, will need to dig further to work out why...

Could be this maybe https://github.com/mapbox/polyline/blob/master/src/polyline.js#L121

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

Successfully merging a pull request may close this issue.

2 participants