@@ -106,7 +106,6 @@ def directions( # noqa: C901
106
106
format : Optional [str ] = "geojson" ,
107
107
preference : Optional [str ] = None ,
108
108
alternative_routes : Optional [dict ] = None ,
109
- units : Optional [str ] = None ,
110
109
language : Optional [str ] = None ,
111
110
geometry : Optional [bool ] = None ,
112
111
geometry_simplify : Optional [bool ] = None ,
@@ -151,9 +150,6 @@ def directions( # noqa: C901
151
150
and "weight_factor".
152
151
:type alternative_routes: dict
153
152
154
- :param units: Specifies the distance unit. One of ["m", "km", "mi"]. Default "m".
155
- :type units: str
156
-
157
153
:param language: Language for routing instructions. One of ["en", "de", "cn",
158
154
"es", "ru", "dk", "fr", "it", "nl", "br", "se", "tr", "gr"].
159
155
:type language: str
@@ -254,9 +250,6 @@ def directions( # noqa: C901
254
250
)
255
251
params ["alternative_routes" ] = alternative_routes
256
252
257
- if units :
258
- params ["units" ] = units
259
-
260
253
if language :
261
254
params ["language" ] = language
262
255
@@ -315,21 +308,14 @@ def directions( # noqa: C901
315
308
dry_run = dry_run ,
316
309
),
317
310
format ,
318
- units ,
319
311
alternative_routes ,
320
312
)
321
313
322
314
@staticmethod
323
- def parse_direction_json (response , format , units , alternative_routes ):
315
+ def parse_direction_json (response , format , alternative_routes ):
324
316
if response is None : # pragma: no cover
325
317
return Direction ()
326
318
327
- units_factor = 1
328
- if units == "mi" :
329
- units_factor = 0.621371 * 1000
330
- elif units == "km" :
331
- units_factor = 1000
332
-
333
319
if format == "geojson" :
334
320
if alternative_routes :
335
321
routes = []
@@ -346,9 +332,7 @@ def parse_direction_json(response, format, units, alternative_routes):
346
332
else :
347
333
geometry = response ["features" ][0 ]["geometry" ]["coordinates" ]
348
334
duration = int (response ["features" ][0 ]["properties" ]["summary" ]["duration" ])
349
- distance = int (
350
- response ["features" ][0 ]["properties" ]["summary" ]["distance" ] * units_factor
351
- )
335
+ distance = int (response ["features" ][0 ]["properties" ]["summary" ]["distance" ])
352
336
return Direction (geometry = geometry , duration = duration , distance = distance , raw = response )
353
337
elif format == "json" :
354
338
if alternative_routes :
@@ -360,7 +344,7 @@ def parse_direction_json(response, format, units, alternative_routes):
360
344
routes .append (
361
345
Direction (
362
346
geometry = geometry ,
363
- distance = int (route ["summary" ]["distance" ] * units_factor ),
347
+ distance = int (route ["summary" ]["distance" ]),
364
348
duration = int (route ["summary" ]["duration" ]),
365
349
raw = route ,
366
350
)
@@ -369,7 +353,7 @@ def parse_direction_json(response, format, units, alternative_routes):
369
353
else :
370
354
geometry = utils .decode_polyline5 (response ["routes" ][0 ]["geometry" ])
371
355
duration = int (response ["routes" ][0 ]["summary" ]["duration" ])
372
- distance = int (response ["routes" ][0 ]["summary" ]["distance" ] * units_factor )
356
+ distance = int (response ["routes" ][0 ]["summary" ]["distance" ])
373
357
374
358
return Direction (geometry = geometry , duration = duration , distance = distance , raw = response )
375
359
@@ -379,7 +363,6 @@ def isochrones(
379
363
profile : str ,
380
364
intervals : List [int ],
381
365
interval_type : Optional [str ] = "time" ,
382
- units : Optional [str ] = None ,
383
366
location_type : Optional [str ] = "start" ,
384
367
smoothing : Optional [float ] = None ,
385
368
attributes : Optional [List [str ]] = None ,
@@ -405,10 +388,6 @@ def isochrones(
405
388
a list of multiple ranges, e.g. [600, 1200, 1400]. In meters or seconds.
406
389
:type intervals: list of int
407
390
408
- :param units: Specifies the unit system to use when displaying results.
409
- One of ["m", "km", "m"]. Default "m".
410
- :type units: str
411
-
412
391
:param location_type: 'start' treats the location(s) as starting point,
413
392
'destination' as goal. Default 'start'.
414
393
:type location_type: str
@@ -441,9 +420,6 @@ def isochrones(
441
420
if interval_type :
442
421
params ["range_type" ] = interval_type
443
422
444
- if units :
445
- params ["units" ] = units
446
-
447
423
if location_type :
448
424
params ["location_type" ] = location_type
449
425
@@ -492,7 +468,6 @@ def matrix(
492
468
destinations : Optional [List [int ]] = None ,
493
469
metrics : Optional [List [str ]] = None ,
494
470
resolve_locations : Optional [bool ] = None ,
495
- units : Optional [str ] = None ,
496
471
dry_run : Optional [bool ] = None ,
497
472
):
498
473
"""Gets travel distance and time for a matrix of origins and destinations.
@@ -524,10 +499,6 @@ def matrix(
524
499
Default False.
525
500
:type resolve_locations: bool
526
501
527
- :param units: Specifies the unit system to use when displaying results.
528
- One of ["m", "km", "m"]. Default "m".
529
- :type units: str
530
-
531
502
:param dry_run: Print URL and parameters without sending the request.
532
503
:param dry_run: bool
533
504
@@ -549,9 +520,6 @@ def matrix(
549
520
if resolve_locations is not None :
550
521
params ["resolve_locations" ] = resolve_locations
551
522
552
- if units :
553
- params ["units" ] = units
554
-
555
523
return self .parse_matrix_json (
556
524
self .client ._request (
557
525
"/v2/matrix/" + profile + "/json" , get_params = {}, post_params = params , dry_run = dry_run
0 commit comments