From df00b5edf1ad748e744d2df9ad4db32a1dba6918 Mon Sep 17 00:00:00 2001 From: Antoine Laurent Date: Fri, 5 Apr 2024 15:43:11 -0400 Subject: [PATCH] fix (_encode_pairs): use dedicated float format If just using function str(), it will not force float ot be written with scientific notation. Thus, it will not be accepted by OSRM API. For example, coordinates '0.0000334622' translate to 3.34622E5 when printed using str, which is not accepted by OSRM --- osrm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osrm.py b/osrm.py index 244c3b1..880b07b 100644 --- a/osrm.py +++ b/osrm.py @@ -133,7 +133,7 @@ def _encode_bool(self, value): return 'true' if value else 'false' def _encode_pairs(self, coordinates): - return ';'.join([','.join(map(str, coord)) for coord in coordinates]) + return ';'.join([','.join(map('{.10f}.format', coord)) for coord in coordinates]) def decode_response(self, url, status, response): if status == 200: