Closed alexisad closed 2 months ago
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)]
I recommend to close this feature request.
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.
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