Skip to content

Isoline Routing API

Module for the HERE Isoline Routing API.

IsolineRoutingApi

Bases: HEREApi

A python interface into the HERE Isoline Routing API.

Source code in src/herepy/isoline_routing_api.py
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
class IsolineRoutingApi(HEREApi):
    """A python interface into the HERE Isoline Routing API."""

    def __init__(self, api_key: str = None, timeout: int = None):
        """
        Initialize a IsolineRoutingApi instance.

        Args:
          api_key (str):
            API key taken from HERE Developer Portal.
          timeout (int):
            Timeout limit for requests.

        """
        super().__init__(api_key, timeout)
        self._base_url = "https://isoline.router.hereapi.com/v8/isolines"

    def __get_error_from_response(self, json_data):
        if "error" in json_data:
            if json_data["error"] == "Unauthorized":
                return UnauthorizedError(json_data["error_description"])
        error_type = json_data.get("Type")
        error_message = json_data.get("Message", "Error occurred on " + sys._getframe(1).f_code.co_name)
        if error_type == "Invalid Request":
            return InvalidRequestError(error_message)
        else:
            return HEREError(error_message)

    def __get_client_error_from_response(self, json_data):
        if "title" in json_data and "cause" in json_data:
            return HEREError("Error on client: " + json_data["title"] + " cause: " + json_data["cause"])
        else:
            return HEREError("herepy got a 400 from isoline router API")

    def __get(self, url, data, json_key):
        url = Utils.build_url(url, extra_params=data)
        response = requests.get(url, timeout=self._timeout)
        json_data = json.loads(response.content.decode("utf8"))
        if json_data.get(json_key) is not None and json_data.get("isolines") is not None:
            return IsolineRoutingResponse.new_from_jsondict(json_data, param_defaults={json_key: None, "isolines": None})
        elif response.status_code == 400:
            error = self.__get_client_error_from_response(json_data=json_data)
            raise error
        else:
            error = self.__get_error_from_response(json_data)
            raise error

    def distance_based_isoline(
        self,
        transport_mode: IsolineRoutingTransportMode,
        origin: list[float],
        ranges: list[int],
        routing_mode: IsolineRoutingMode,
    ) -> IsolineRoutingResponse | None:
        """
        Calculate a distance-based isoline (isodistance).

        Request it with range[type]=distance and range[values] in meters.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          origin (List):
            List including latitude and longitude in order.
          ranges (List):
            List of range values for isoline (in meters).
          routing_mode (IsolineRoutingMode):
            Isoline routing mode.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.distance.__str__(),
            "range[values]": ",".join(string_ranges),
            "routingMode": routing_mode.__str__(),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "departure")

    def time_isoline(
        self,
        transport_mode: IsolineRoutingTransportMode,
        origin: list[float],
        ranges: list[int],
    ) -> IsolineRoutingResponse | None:
        """
        Calculate a time-based isoline (isochrone).

        Request it with range[type]=time and range[values] in seconds.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          origin (List):
            List including latitude and longitude in order.
          ranges (List):
            List of range values for isoline (in meters).

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "departure")

    def isoline_based_on_consumption(
        self,
        origin: list[float],
        ranges: list[int],
        transport_mode: IsolineRoutingTransportMode,
        free_flow_speed_table: list[float],
        traffic_speed_table: list[float],
        ascent: int,
        descent: float,
        auxiliary_consumption: float,
    ):
        """
        Calculate an electric vehicle isoline based on energy consumption.

        Reachable range depends on the battery charge and factors such as road slope or
        auxiliary power usage.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          origin (List):
            List including latitude and longitude in order.
          ranges (List):
            List of range values for isoline (in meters).
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          free_flow_speed_table (List[float]):
            Free flow speed table.
          traffic_speed_table (List[float]):
            Traffic speed table.
          ascent (int):
            Int value of ascent.
          descent (float):
            Value of descent.
          auxiliary_consumption (float):
            Auxiliary consumption.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]

        free_speed_table: list[int | float] = [0]
        free_speed_table.extend(free_flow_speed_table)
        free_speed_table_str = ",".join([str(n) for n in free_speed_table])

        speed_table: list[int | float] = [0]
        speed_table.extend(traffic_speed_table)
        speed_table_str = ",".join([str(n) for n in speed_table])

        data = {
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.consumption.__str__(),
            "range[values]": ",".join(string_ranges),
            "transportMode": transport_mode.__str__(),
            "ev[freeFlowSpeedTable]": free_speed_table_str,
            "ev[trafficSpeedTable]": speed_table_str,
            "ev[ascent]": ascent,
            "ev[descent]": descent,
            "ev[auxiliaryConsumption]": auxiliary_consumption,
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "departure")

    def isoline_routing_at_specific_time(
        self,
        transport_mode: IsolineRoutingTransportMode,
        ranges: list[int],
        origin: list[float] | None = None,
        departure_time: str | None = None,
        destination: list[float] | None = None,
        arrival_time: str | None = None,
    ):
        """
        To calculate an isoline around an origin with a specific time, use departureTime.

        For a reverse isoline, that is, when using destination, you can use arrivalTime.
        If departureTime or arrivalTime are specified as "any", the isoline calculation will
        not take traffic flow and other time-dependent effects into account. This can be useful
        when it is not certain for what time of the day the isoline needs to be computed.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          ranges (List):
            List of range values for isoline (in meters).
          origin (List):
            List including latitude and longitude in order.
          departure_time (str):
            Departure time of the routing in format yyyy-MM-ddThh:mm:ss.
          destination (List):
            List including latitude and longitude in order.
          arrival_time (str):
            Arrival time of the planned routing in format yyyy-MM-ddThh:mm:ss.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        if origin and departure_time:
            data = {
                "transportMode": transport_mode.__str__(),
                "origin": str.format("{0},{1}", origin[0], origin[1]),
                "departureTime": departure_time,
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return self.__get(self._base_url, data, "departure")
        elif destination and arrival_time:
            data = {
                "transportMode": transport_mode.__str__(),
                "destination": str.format("{0},{1}", destination[0], destination[1]),
                "arrivalTime": arrival_time,
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return self.__get(self._base_url, data, "arrival")
        else:
            raise HEREError("Please provide either origin & departure_time or destination & arrival_time.")

    def multi_range_routing(
        self,
        transport_mode: IsolineRoutingTransportMode,
        ranges: list[int],
        origin: list[float] | None = None,
        destination: list[float] | None = None,
    ):
        """
        Calculate multiple isolines from one origin or destination.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          ranges (List):
            Range values for isoline routing.
          origin (List):
            List including latitude and longitude in order.
          destination (List):
            List including latitude and longitude in order.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        if origin:
            data = {
                "transportMode": transport_mode.__str__(),
                "origin": str.format("{0},{1}", origin[0], origin[1]),
                "range[type]": IsolineRoutingRangeType.distance.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return self.__get(self._base_url, data, "departure")
        elif destination:
            data = {
                "transportMode": transport_mode.__str__(),
                "destination": str.format("{0},{1}", destination[0], destination[1]),
                "range[type]": IsolineRoutingRangeType.distance.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return self.__get(self._base_url, data, "arrival")
        else:
            raise HEREError("Please provide values for origin or destination parameter.")

    def reverse_direction_isoline(
        self,
        transport_mode: IsolineRoutingTransportMode,
        ranges: list[int],
        origin: list[float] | None = None,
        destination: list[float] | None = None,
    ):
        """
        Calculate an isoline in the reverse direction.

        To trigger calculation in reverse direction,
        use the destination parameter instead of origin.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          ranges (List):
            Range values for isoline routing.
          origin (List):
            List including latitude and longitude in order.
          destination (List):
            List including latitude and longitude in order.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        if origin:
            data = {
                "transportMode": transport_mode.__str__(),
                "origin": str.format("{0},{1}", origin[0], origin[1]),
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return self.__get(self._base_url, data, "departure")
        elif destination:
            data = {
                "transportMode": transport_mode.__str__(),
                "destination": str.format("{0},{1}", destination[0], destination[1]),
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": range,
                "apiKey": self._api_key,
            }
            return self.__get(self._base_url, data, "arrival")
        else:
            raise HEREError("Please provide values for origin or destination parameter.")

    async def __get_async(self, url, data, json_key):
        url = Utils.build_url(url, extra_params=data)
        response = await self._get_async_client().get(url, timeout=self._timeout)
        json_data = json.loads(response.content.decode("utf8"))
        if json_data.get(json_key) is not None and json_data.get("isolines") is not None:
            return IsolineRoutingResponse.new_from_jsondict(json_data, param_defaults={json_key: None, "isolines": None})
        elif response.status_code == 400:
            error = self.__get_client_error_from_response(json_data=json_data)
            raise error
        else:
            error = self.__get_error_from_response(json_data)
            raise error

    async def async_distance_based_isoline(
        self,
        transport_mode: IsolineRoutingTransportMode,
        origin: list[float],
        ranges: list[int],
        routing_mode: IsolineRoutingMode,
    ) -> IsolineRoutingResponse | None:
        """
        Calculate a distance-based isoline (isodistance).

        Request it with range[type]=distance and range[values] in meters.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          origin (List):
            List including latitude and longitude in order.
          ranges (List):
            List of range values for isoline (in meters).
          routing_mode (IsolineRoutingMode):
            Isoline routing mode.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.distance.__str__(),
            "range[values]": ",".join(string_ranges),
            "routingMode": routing_mode.__str__(),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "departure")

    async def async_time_isoline(
        self,
        transport_mode: IsolineRoutingTransportMode,
        origin: list[float],
        ranges: list[int],
    ) -> IsolineRoutingResponse | None:
        """
        Calculate a time-based isoline (isochrone).

        Request it with range[type]=time and range[values] in seconds.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          origin (List):
            List including latitude and longitude in order.
          ranges (List):
            List of range values for isoline (in meters).

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "departure")

    async def async_isoline_based_on_consumption(
        self,
        origin: list[float],
        ranges: list[int],
        transport_mode: IsolineRoutingTransportMode,
        free_flow_speed_table: list[float],
        traffic_speed_table: list[float],
        ascent: int,
        descent: float,
        auxiliary_consumption: float,
    ):
        """
        Calculate an electric vehicle isoline based on energy consumption.

        Reachable range depends on the battery charge and factors such as road slope or
        auxiliary power usage.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          origin (List):
            List including latitude and longitude in order.
          ranges (List):
            List of range values for isoline (in meters).
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          free_flow_speed_table (List[float]):
            Free flow speed table.
          traffic_speed_table (List[float]):
            Traffic speed table.
          ascent (int):
            Int value of ascent.
          descent (float):
            Value of descent.
          auxiliary_consumption (float):
            Auxiliary consumption.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]

        free_speed_table: list[int | float] = [0]
        free_speed_table.extend(free_flow_speed_table)
        free_speed_table_str = ",".join([str(n) for n in free_speed_table])

        speed_table: list[int | float] = [0]
        speed_table.extend(traffic_speed_table)
        speed_table_str = ",".join([str(n) for n in speed_table])

        data = {
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.consumption.__str__(),
            "range[values]": ",".join(string_ranges),
            "transportMode": transport_mode.__str__(),
            "ev[freeFlowSpeedTable]": free_speed_table_str,
            "ev[trafficSpeedTable]": speed_table_str,
            "ev[ascent]": ascent,
            "ev[descent]": descent,
            "ev[auxiliaryConsumption]": auxiliary_consumption,
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "departure")

    async def async_isoline_routing_at_specific_time(
        self,
        transport_mode: IsolineRoutingTransportMode,
        ranges: list[int],
        origin: list[float] | None = None,
        departure_time: str | None = None,
        destination: list[float] | None = None,
        arrival_time: str | None = None,
    ):
        """
        To calculate an isoline around an origin with a specific time, use departureTime.

        For a reverse isoline, that is, when using destination, you can use arrivalTime.
        If departureTime or arrivalTime are specified as "any", the isoline calculation will
        not take traffic flow and other time-dependent effects into account. This can be useful
        when it is not certain for what time of the day the isoline needs to be computed.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          ranges (List):
            List of range values for isoline (in meters).
          origin (List):
            List including latitude and longitude in order.
          departure_time (str):
            Departure time of the routing in format yyyy-MM-ddThh:mm:ss.
          destination (List):
            List including latitude and longitude in order.
          arrival_time (str):
            Arrival time of the planned routing in format yyyy-MM-ddThh:mm:ss.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        if origin and departure_time:
            data = {
                "transportMode": transport_mode.__str__(),
                "origin": str.format("{0},{1}", origin[0], origin[1]),
                "departureTime": departure_time,
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return await self.__get_async(self._base_url, data, "departure")
        elif destination and arrival_time:
            data = {
                "transportMode": transport_mode.__str__(),
                "destination": str.format("{0},{1}", destination[0], destination[1]),
                "arrivalTime": arrival_time,
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return await self.__get_async(self._base_url, data, "arrival")
        else:
            raise HEREError("Please provide either origin & departure_time or destination & arrival_time.")

    async def async_multi_range_routing(
        self,
        transport_mode: IsolineRoutingTransportMode,
        ranges: list[int],
        origin: list[float] | None = None,
        destination: list[float] | None = None,
    ):
        """
        Calculate multiple isolines from one origin or destination.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          ranges (List):
            Range values for isoline routing.
          origin (List):
            List including latitude and longitude in order.
          destination (List):
            List including latitude and longitude in order.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        if origin:
            data = {
                "transportMode": transport_mode.__str__(),
                "origin": str.format("{0},{1}", origin[0], origin[1]),
                "range[type]": IsolineRoutingRangeType.distance.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return await self.__get_async(self._base_url, data, "departure")
        elif destination:
            data = {
                "transportMode": transport_mode.__str__(),
                "destination": str.format("{0},{1}", destination[0], destination[1]),
                "range[type]": IsolineRoutingRangeType.distance.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return await self.__get_async(self._base_url, data, "arrival")
        else:
            raise HEREError("Please provide values for origin or destination parameter.")

    async def async_reverse_direction_isoline(
        self,
        transport_mode: IsolineRoutingTransportMode,
        ranges: list[int],
        origin: list[float] | None = None,
        destination: list[float] | None = None,
    ):
        """
        Calculate an isoline in the reverse direction.

        To trigger calculation in reverse direction,
        use the destination parameter instead of origin.

        Args:
          transport_mode (IsolineRoutingTransportMode):
            Transport mode of routing.
          ranges (List):
            Range values for isoline routing.
          origin (List):
            List including latitude and longitude in order.
          destination (List):
            List including latitude and longitude in order.

        Returns:
          IsolineRoutingResponse
        Raises:
          HEREError

        """
        string_ranges = [str(int) for int in ranges]
        if origin:
            data = {
                "transportMode": transport_mode.__str__(),
                "origin": str.format("{0},{1}", origin[0], origin[1]),
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": ",".join(string_ranges),
                "apiKey": self._api_key,
            }
            return await self.__get_async(self._base_url, data, "departure")
        elif destination:
            data = {
                "transportMode": transport_mode.__str__(),
                "destination": str.format("{0},{1}", destination[0], destination[1]),
                "range[type]": IsolineRoutingRangeType.time.__str__(),
                "range[values]": range,
                "apiKey": self._api_key,
            }
            return await self.__get_async(self._base_url, data, "arrival")
        else:
            raise HEREError("Please provide values for origin or destination parameter.")

__init__(api_key=None, timeout=None)

Initialize a IsolineRoutingApi instance.

Parameters:

Name Type Description Default
api_key str

API key taken from HERE Developer Portal.

None
timeout int

Timeout limit for requests.

None
Source code in src/herepy/isoline_routing_api.py
24
25
26
27
28
29
30
31
32
33
34
35
36
def __init__(self, api_key: str = None, timeout: int = None):
    """
    Initialize a IsolineRoutingApi instance.

    Args:
      api_key (str):
        API key taken from HERE Developer Portal.
      timeout (int):
        Timeout limit for requests.

    """
    super().__init__(api_key, timeout)
    self._base_url = "https://isoline.router.hereapi.com/v8/isolines"

async_distance_based_isoline(transport_mode, origin, ranges, routing_mode) async

Calculate a distance-based isoline (isodistance).

Request it with range[type]=distance and range[values] in meters.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
origin List

List including latitude and longitude in order.

required
ranges List

List of range values for isoline (in meters).

required
routing_mode IsolineRoutingMode

Isoline routing mode.

required

Returns:

Type Description
IsolineRoutingResponse | None

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
async def async_distance_based_isoline(
    self,
    transport_mode: IsolineRoutingTransportMode,
    origin: list[float],
    ranges: list[int],
    routing_mode: IsolineRoutingMode,
) -> IsolineRoutingResponse | None:
    """
    Calculate a distance-based isoline (isodistance).

    Request it with range[type]=distance and range[values] in meters.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      origin (List):
        List including latitude and longitude in order.
      ranges (List):
        List of range values for isoline (in meters).
      routing_mode (IsolineRoutingMode):
        Isoline routing mode.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    data = {
        "transportMode": transport_mode.__str__(),
        "origin": str.format("{0},{1}", origin[0], origin[1]),
        "range[type]": IsolineRoutingRangeType.distance.__str__(),
        "range[values]": ",".join(string_ranges),
        "routingMode": routing_mode.__str__(),
        "apiKey": self._api_key,
    }
    return await self.__get_async(self._base_url, data, "departure")

async_isoline_based_on_consumption(origin, ranges, transport_mode, free_flow_speed_table, traffic_speed_table, ascent, descent, auxiliary_consumption) async

Calculate an electric vehicle isoline based on energy consumption.

Reachable range depends on the battery charge and factors such as road slope or auxiliary power usage.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
origin List

List including latitude and longitude in order.

required
ranges List

List of range values for isoline (in meters).

required
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
free_flow_speed_table List[float]

Free flow speed table.

required
traffic_speed_table List[float]

Traffic speed table.

required
ascent int

Int value of ascent.

required
descent float

Value of descent.

required
auxiliary_consumption float

Auxiliary consumption.

required

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
async def async_isoline_based_on_consumption(
    self,
    origin: list[float],
    ranges: list[int],
    transport_mode: IsolineRoutingTransportMode,
    free_flow_speed_table: list[float],
    traffic_speed_table: list[float],
    ascent: int,
    descent: float,
    auxiliary_consumption: float,
):
    """
    Calculate an electric vehicle isoline based on energy consumption.

    Reachable range depends on the battery charge and factors such as road slope or
    auxiliary power usage.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      origin (List):
        List including latitude and longitude in order.
      ranges (List):
        List of range values for isoline (in meters).
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      free_flow_speed_table (List[float]):
        Free flow speed table.
      traffic_speed_table (List[float]):
        Traffic speed table.
      ascent (int):
        Int value of ascent.
      descent (float):
        Value of descent.
      auxiliary_consumption (float):
        Auxiliary consumption.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]

    free_speed_table: list[int | float] = [0]
    free_speed_table.extend(free_flow_speed_table)
    free_speed_table_str = ",".join([str(n) for n in free_speed_table])

    speed_table: list[int | float] = [0]
    speed_table.extend(traffic_speed_table)
    speed_table_str = ",".join([str(n) for n in speed_table])

    data = {
        "origin": str.format("{0},{1}", origin[0], origin[1]),
        "range[type]": IsolineRoutingRangeType.consumption.__str__(),
        "range[values]": ",".join(string_ranges),
        "transportMode": transport_mode.__str__(),
        "ev[freeFlowSpeedTable]": free_speed_table_str,
        "ev[trafficSpeedTable]": speed_table_str,
        "ev[ascent]": ascent,
        "ev[descent]": descent,
        "ev[auxiliaryConsumption]": auxiliary_consumption,
        "apiKey": self._api_key,
    }
    return await self.__get_async(self._base_url, data, "departure")

async_isoline_routing_at_specific_time(transport_mode, ranges, origin=None, departure_time=None, destination=None, arrival_time=None) async

To calculate an isoline around an origin with a specific time, use departureTime.

For a reverse isoline, that is, when using destination, you can use arrivalTime. If departureTime or arrivalTime are specified as "any", the isoline calculation will not take traffic flow and other time-dependent effects into account. This can be useful when it is not certain for what time of the day the isoline needs to be computed.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
ranges List

List of range values for isoline (in meters).

required
origin List

List including latitude and longitude in order.

None
departure_time str

Departure time of the routing in format yyyy-MM-ddThh:mm:ss.

None
destination List

List including latitude and longitude in order.

None
arrival_time str

Arrival time of the planned routing in format yyyy-MM-ddThh:mm:ss.

None

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
async def async_isoline_routing_at_specific_time(
    self,
    transport_mode: IsolineRoutingTransportMode,
    ranges: list[int],
    origin: list[float] | None = None,
    departure_time: str | None = None,
    destination: list[float] | None = None,
    arrival_time: str | None = None,
):
    """
    To calculate an isoline around an origin with a specific time, use departureTime.

    For a reverse isoline, that is, when using destination, you can use arrivalTime.
    If departureTime or arrivalTime are specified as "any", the isoline calculation will
    not take traffic flow and other time-dependent effects into account. This can be useful
    when it is not certain for what time of the day the isoline needs to be computed.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      ranges (List):
        List of range values for isoline (in meters).
      origin (List):
        List including latitude and longitude in order.
      departure_time (str):
        Departure time of the routing in format yyyy-MM-ddThh:mm:ss.
      destination (List):
        List including latitude and longitude in order.
      arrival_time (str):
        Arrival time of the planned routing in format yyyy-MM-ddThh:mm:ss.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    if origin and departure_time:
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "departureTime": departure_time,
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "departure")
    elif destination and arrival_time:
        data = {
            "transportMode": transport_mode.__str__(),
            "destination": str.format("{0},{1}", destination[0], destination[1]),
            "arrivalTime": arrival_time,
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "arrival")
    else:
        raise HEREError("Please provide either origin & departure_time or destination & arrival_time.")

async_multi_range_routing(transport_mode, ranges, origin=None, destination=None) async

Calculate multiple isolines from one origin or destination.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
ranges List

Range values for isoline routing.

required
origin List

List including latitude and longitude in order.

None
destination List

List including latitude and longitude in order.

None

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
async def async_multi_range_routing(
    self,
    transport_mode: IsolineRoutingTransportMode,
    ranges: list[int],
    origin: list[float] | None = None,
    destination: list[float] | None = None,
):
    """
    Calculate multiple isolines from one origin or destination.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      ranges (List):
        Range values for isoline routing.
      origin (List):
        List including latitude and longitude in order.
      destination (List):
        List including latitude and longitude in order.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    if origin:
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.distance.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "departure")
    elif destination:
        data = {
            "transportMode": transport_mode.__str__(),
            "destination": str.format("{0},{1}", destination[0], destination[1]),
            "range[type]": IsolineRoutingRangeType.distance.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "arrival")
    else:
        raise HEREError("Please provide values for origin or destination parameter.")

async_reverse_direction_isoline(transport_mode, ranges, origin=None, destination=None) async

Calculate an isoline in the reverse direction.

To trigger calculation in reverse direction, use the destination parameter instead of origin.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
ranges List

Range values for isoline routing.

required
origin List

List including latitude and longitude in order.

None
destination List

List including latitude and longitude in order.

None

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
async def async_reverse_direction_isoline(
    self,
    transport_mode: IsolineRoutingTransportMode,
    ranges: list[int],
    origin: list[float] | None = None,
    destination: list[float] | None = None,
):
    """
    Calculate an isoline in the reverse direction.

    To trigger calculation in reverse direction,
    use the destination parameter instead of origin.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      ranges (List):
        Range values for isoline routing.
      origin (List):
        List including latitude and longitude in order.
      destination (List):
        List including latitude and longitude in order.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    if origin:
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "departure")
    elif destination:
        data = {
            "transportMode": transport_mode.__str__(),
            "destination": str.format("{0},{1}", destination[0], destination[1]),
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": range,
            "apiKey": self._api_key,
        }
        return await self.__get_async(self._base_url, data, "arrival")
    else:
        raise HEREError("Please provide values for origin or destination parameter.")

async_time_isoline(transport_mode, origin, ranges) async

Calculate a time-based isoline (isochrone).

Request it with range[type]=time and range[values] in seconds.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
origin List

List including latitude and longitude in order.

required
ranges List

List of range values for isoline (in meters).

required

Returns:

Type Description
IsolineRoutingResponse | None

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
async def async_time_isoline(
    self,
    transport_mode: IsolineRoutingTransportMode,
    origin: list[float],
    ranges: list[int],
) -> IsolineRoutingResponse | None:
    """
    Calculate a time-based isoline (isochrone).

    Request it with range[type]=time and range[values] in seconds.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      origin (List):
        List including latitude and longitude in order.
      ranges (List):
        List of range values for isoline (in meters).

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    data = {
        "transportMode": transport_mode.__str__(),
        "origin": str.format("{0},{1}", origin[0], origin[1]),
        "range[type]": IsolineRoutingRangeType.time.__str__(),
        "range[values]": ",".join(string_ranges),
        "apiKey": self._api_key,
    }
    return await self.__get_async(self._base_url, data, "departure")

distance_based_isoline(transport_mode, origin, ranges, routing_mode)

Calculate a distance-based isoline (isodistance).

Request it with range[type]=distance and range[values] in meters.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
origin List

List including latitude and longitude in order.

required
ranges List

List of range values for isoline (in meters).

required
routing_mode IsolineRoutingMode

Isoline routing mode.

required

Returns:

Type Description
IsolineRoutingResponse | None

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
def distance_based_isoline(
    self,
    transport_mode: IsolineRoutingTransportMode,
    origin: list[float],
    ranges: list[int],
    routing_mode: IsolineRoutingMode,
) -> IsolineRoutingResponse | None:
    """
    Calculate a distance-based isoline (isodistance).

    Request it with range[type]=distance and range[values] in meters.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      origin (List):
        List including latitude and longitude in order.
      ranges (List):
        List of range values for isoline (in meters).
      routing_mode (IsolineRoutingMode):
        Isoline routing mode.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    data = {
        "transportMode": transport_mode.__str__(),
        "origin": str.format("{0},{1}", origin[0], origin[1]),
        "range[type]": IsolineRoutingRangeType.distance.__str__(),
        "range[values]": ",".join(string_ranges),
        "routingMode": routing_mode.__str__(),
        "apiKey": self._api_key,
    }
    return self.__get(self._base_url, data, "departure")

isoline_based_on_consumption(origin, ranges, transport_mode, free_flow_speed_table, traffic_speed_table, ascent, descent, auxiliary_consumption)

Calculate an electric vehicle isoline based on energy consumption.

Reachable range depends on the battery charge and factors such as road slope or auxiliary power usage.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
origin List

List including latitude and longitude in order.

required
ranges List

List of range values for isoline (in meters).

required
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
free_flow_speed_table List[float]

Free flow speed table.

required
traffic_speed_table List[float]

Traffic speed table.

required
ascent int

Int value of ascent.

required
descent float

Value of descent.

required
auxiliary_consumption float

Auxiliary consumption.

required

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
def isoline_based_on_consumption(
    self,
    origin: list[float],
    ranges: list[int],
    transport_mode: IsolineRoutingTransportMode,
    free_flow_speed_table: list[float],
    traffic_speed_table: list[float],
    ascent: int,
    descent: float,
    auxiliary_consumption: float,
):
    """
    Calculate an electric vehicle isoline based on energy consumption.

    Reachable range depends on the battery charge and factors such as road slope or
    auxiliary power usage.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      origin (List):
        List including latitude and longitude in order.
      ranges (List):
        List of range values for isoline (in meters).
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      free_flow_speed_table (List[float]):
        Free flow speed table.
      traffic_speed_table (List[float]):
        Traffic speed table.
      ascent (int):
        Int value of ascent.
      descent (float):
        Value of descent.
      auxiliary_consumption (float):
        Auxiliary consumption.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]

    free_speed_table: list[int | float] = [0]
    free_speed_table.extend(free_flow_speed_table)
    free_speed_table_str = ",".join([str(n) for n in free_speed_table])

    speed_table: list[int | float] = [0]
    speed_table.extend(traffic_speed_table)
    speed_table_str = ",".join([str(n) for n in speed_table])

    data = {
        "origin": str.format("{0},{1}", origin[0], origin[1]),
        "range[type]": IsolineRoutingRangeType.consumption.__str__(),
        "range[values]": ",".join(string_ranges),
        "transportMode": transport_mode.__str__(),
        "ev[freeFlowSpeedTable]": free_speed_table_str,
        "ev[trafficSpeedTable]": speed_table_str,
        "ev[ascent]": ascent,
        "ev[descent]": descent,
        "ev[auxiliaryConsumption]": auxiliary_consumption,
        "apiKey": self._api_key,
    }
    return self.__get(self._base_url, data, "departure")

isoline_routing_at_specific_time(transport_mode, ranges, origin=None, departure_time=None, destination=None, arrival_time=None)

To calculate an isoline around an origin with a specific time, use departureTime.

For a reverse isoline, that is, when using destination, you can use arrivalTime. If departureTime or arrivalTime are specified as "any", the isoline calculation will not take traffic flow and other time-dependent effects into account. This can be useful when it is not certain for what time of the day the isoline needs to be computed.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
ranges List

List of range values for isoline (in meters).

required
origin List

List including latitude and longitude in order.

None
departure_time str

Departure time of the routing in format yyyy-MM-ddThh:mm:ss.

None
destination List

List including latitude and longitude in order.

None
arrival_time str

Arrival time of the planned routing in format yyyy-MM-ddThh:mm:ss.

None

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
def isoline_routing_at_specific_time(
    self,
    transport_mode: IsolineRoutingTransportMode,
    ranges: list[int],
    origin: list[float] | None = None,
    departure_time: str | None = None,
    destination: list[float] | None = None,
    arrival_time: str | None = None,
):
    """
    To calculate an isoline around an origin with a specific time, use departureTime.

    For a reverse isoline, that is, when using destination, you can use arrivalTime.
    If departureTime or arrivalTime are specified as "any", the isoline calculation will
    not take traffic flow and other time-dependent effects into account. This can be useful
    when it is not certain for what time of the day the isoline needs to be computed.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      ranges (List):
        List of range values for isoline (in meters).
      origin (List):
        List including latitude and longitude in order.
      departure_time (str):
        Departure time of the routing in format yyyy-MM-ddThh:mm:ss.
      destination (List):
        List including latitude and longitude in order.
      arrival_time (str):
        Arrival time of the planned routing in format yyyy-MM-ddThh:mm:ss.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    if origin and departure_time:
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "departureTime": departure_time,
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "departure")
    elif destination and arrival_time:
        data = {
            "transportMode": transport_mode.__str__(),
            "destination": str.format("{0},{1}", destination[0], destination[1]),
            "arrivalTime": arrival_time,
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "arrival")
    else:
        raise HEREError("Please provide either origin & departure_time or destination & arrival_time.")

multi_range_routing(transport_mode, ranges, origin=None, destination=None)

Calculate multiple isolines from one origin or destination.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
ranges List

Range values for isoline routing.

required
origin List

List including latitude and longitude in order.

None
destination List

List including latitude and longitude in order.

None

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
def multi_range_routing(
    self,
    transport_mode: IsolineRoutingTransportMode,
    ranges: list[int],
    origin: list[float] | None = None,
    destination: list[float] | None = None,
):
    """
    Calculate multiple isolines from one origin or destination.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      ranges (List):
        Range values for isoline routing.
      origin (List):
        List including latitude and longitude in order.
      destination (List):
        List including latitude and longitude in order.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    if origin:
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.distance.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "departure")
    elif destination:
        data = {
            "transportMode": transport_mode.__str__(),
            "destination": str.format("{0},{1}", destination[0], destination[1]),
            "range[type]": IsolineRoutingRangeType.distance.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "arrival")
    else:
        raise HEREError("Please provide values for origin or destination parameter.")

reverse_direction_isoline(transport_mode, ranges, origin=None, destination=None)

Calculate an isoline in the reverse direction.

To trigger calculation in reverse direction, use the destination parameter instead of origin.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
ranges List

Range values for isoline routing.

required
origin List

List including latitude and longitude in order.

None
destination List

List including latitude and longitude in order.

None

Returns:

Type Description

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
def reverse_direction_isoline(
    self,
    transport_mode: IsolineRoutingTransportMode,
    ranges: list[int],
    origin: list[float] | None = None,
    destination: list[float] | None = None,
):
    """
    Calculate an isoline in the reverse direction.

    To trigger calculation in reverse direction,
    use the destination parameter instead of origin.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      ranges (List):
        Range values for isoline routing.
      origin (List):
        List including latitude and longitude in order.
      destination (List):
        List including latitude and longitude in order.

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    if origin:
        data = {
            "transportMode": transport_mode.__str__(),
            "origin": str.format("{0},{1}", origin[0], origin[1]),
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": ",".join(string_ranges),
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "departure")
    elif destination:
        data = {
            "transportMode": transport_mode.__str__(),
            "destination": str.format("{0},{1}", destination[0], destination[1]),
            "range[type]": IsolineRoutingRangeType.time.__str__(),
            "range[values]": range,
            "apiKey": self._api_key,
        }
        return self.__get(self._base_url, data, "arrival")
    else:
        raise HEREError("Please provide values for origin or destination parameter.")

time_isoline(transport_mode, origin, ranges)

Calculate a time-based isoline (isochrone).

Request it with range[type]=time and range[values] in seconds.

Parameters:

Name Type Description Default
transport_mode IsolineRoutingTransportMode

Transport mode of routing.

required
origin List

List including latitude and longitude in order.

required
ranges List

List of range values for isoline (in meters).

required

Returns:

Type Description
IsolineRoutingResponse | None

IsolineRoutingResponse

Raises: HEREError

Source code in src/herepy/isoline_routing_api.py
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
def time_isoline(
    self,
    transport_mode: IsolineRoutingTransportMode,
    origin: list[float],
    ranges: list[int],
) -> IsolineRoutingResponse | None:
    """
    Calculate a time-based isoline (isochrone).

    Request it with range[type]=time and range[values] in seconds.

    Args:
      transport_mode (IsolineRoutingTransportMode):
        Transport mode of routing.
      origin (List):
        List including latitude and longitude in order.
      ranges (List):
        List of range values for isoline (in meters).

    Returns:
      IsolineRoutingResponse
    Raises:
      HEREError

    """
    string_ranges = [str(int) for int in ranges]
    data = {
        "transportMode": transport_mode.__str__(),
        "origin": str.format("{0},{1}", origin[0], origin[1]),
        "range[type]": IsolineRoutingRangeType.time.__str__(),
        "range[values]": ",".join(string_ranges),
        "apiKey": self._api_key,
    }
    return self.__get(self._base_url, data, "departure")