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

reading and writing coordinates doesn't return same values #38

Open
jtheuer opened this issue Apr 2, 2018 · 2 comments
Open

reading and writing coordinates doesn't return same values #38

jtheuer opened this issue Apr 2, 2018 · 2 comments
Labels

Comments

@jtheuer
Copy link

jtheuer commented Apr 2, 2018

$> echo '{"type":"LineString", "coordinates": [[10,52],[10.1,52.1]]}' | polyline --fromGeoJSON | polyline
[[-0.00002,52],[9.99998,52.1],[10.09998,52.09998]]

The rounding errors are probably by design but the coordinates are somehow corrupted.

@mapbox/[email protected]

@jfirebaugh
Copy link
Contributor

polyline --fromGeoJSON and polyline --encode include leading and trailing quotes in the output, as if it were a JSON string, which means that output can't be piped directly back into polyline --decode. I think this is probably a bug, although fixing it would break any applications that expect the quotes. @nerik, as the original author of the CLI, what do you think?

@nerik
Copy link
Contributor

nerik commented Apr 23, 2018

Sorry for the late reply.
This is a bug, I think quotes should just be removed from the encoded polyline output - this is an easy fix. Maybe bump to a new major version?
Any other solution seems unclean to me: keep wrongly outputting quotes, adding some mechanism to detect leading/trailing quotes when using decode /toGeoJSON, but I'm happy to implement that too.

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

No branches or pull requests

4 participants