info olaf
info olaf

Reputation: 11

what is local time for the here api routing calculations

when you set departureTime param for your isoline calculations, the departure time is the local time, but which local time ? The local time of the location departure point, the local time of my web server location ? Is it possible to be more accurate ? Thanks in advance

Upvotes: -1

Views: 203

Answers (1)

astro.comma
astro.comma

Reputation: 181

The following statement in your original question is not accurate:

the departure time is the local time

The Isoline Routing API v8 uses RFC 3339 for the departureTime parameter, so the departure time can be any time and any timezone you want, it doesn't have to be "local".

According to the API documentation, the requested time is converted to the local time at destination. In your case, this means that no matter what time and timezone you use, the service will always adjust it to the time of the city where your coordinates are (origin or destination parameter). Let me give you a few examples:

Example 1: Different timezones

Consider the following request where the coordinates in the origin parameter are in Berlin, Germany:

https://isoline.router.hereapi.com/v8/isolines?
apikey=************&
origin=52.525927,13.388686&
departureTime=2022-01-05T10:00:00-06:00&
range[type]=time&
range[values]=600&
transportMode=car

The timezone offset in the request is -06:00, and it's +01:00 at the origin coordinates (Berlin), so the service converts the input time and uses 2022-01-05T17:00:00+01:00 for the isoline calculation.

Example 2: Same timezone

https://isoline.router.hereapi.com/v8/isolines?
apikey=************&
origin=52.525927,13.388686&
departureTime=2022-01-05T10:00:00+01:00&
range[type]=time&
range[values]=600&
transportMode=car

Since the timezone offset in the request (+01:00) is the same as the timezome at our coordinates location, the service will use the same timestamp for the isoline calculation: 2022-01-05T10:00:00+01:00.

Example 3: Unspecified timezone offset

https://isoline.router.hereapi.com/v8/isolines?
apikey=************&
origin=52.525927,13.388686&
departureTime=2022-01-05T10:00:00&
range[type]=time&
range[values]=600&
transportMode=car

According to the API documentation, when the timezone offset is not specified, the time is assumed to be local. Since we're still using those coordinates located in Berlin, "local" here means UTC +01:00, so the service uses 2022-01-05T10:00:00+01:00 for the isoline calculation.

Example 4: The "Z" suffix

https://isoline.router.hereapi.com/v8/isolines?
apikey=************&
origin=52.525927,13.388686&
departureTime=2022-01-05T10:00:00Z&
range[type]=time&
range[values]=600&
transportMode=car

In RFC 3339, the "Z" suffix denotes denotes a UTC offset of 00:00. In this scenario, the service uses 2022-01-05T11:00:00+01:00 for the isoline calculation.

Upvotes: 2

Related Questions