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

'Decode' function for python doesn't have 'precision' parameter #59

Open
alexisad opened this issue Oct 6, 2022 · 2 comments
Open

'Decode' function for python doesn't have 'precision' parameter #59

alexisad opened this issue Oct 6, 2022 · 2 comments

Comments

@alexisad
Copy link

alexisad commented Oct 6, 2022

Regarding this: https://developer.here.com/documentation/here-lanes/dev_guide/topics/hd-map-coordinate-encoding.html
Platform data topologies have 7 digits of precision after the decimal point.
But decode function by default returns only 5 digits after the decimal point.

Please add 'precision' parameter in the 'decode' function. Thanks

@gtsystem
Copy link

The decoded precision depends on the precision used when encoding the polyline. The encoder has a default of 5 digits of precision but there is a parameter to change that:

import flexpolyline as fp
input = [
    (50.1022829, 8.6982122),
    (50.1020076, 8.6956695),
    (50.1006313, 8.6914960),
    (50.0987800, 8.6875156),
]
res = fp.encode(input, precision=7)
print(fp.decode(res))

Output:

[(50.1022829, 8.6982122), (50.1020076, 8.6956695), (50.1006313, 8.691496), (50.09878, 8.6875156)]

@frankgae
Copy link
Member

frankgae commented Jun 6, 2024

I recommend to close this feature request.

  1. As Giuseppe commented, the number of available decimals depends on the precision specified during encoding, not the decoding.
  2. "Reducing" the precision of the decoded coordinates is basically a 1-liner in Python. e.g:
        pts = fp.decode(s)
        pts = [(round(lat, 3), round(lng, 3)) for lat, lng in pts]

This doesn't justify adding 'precision' and 'precision3d' arguments to the 'decode' method.

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

3 participants