-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Timezone issue in 'connection()' and 'intermodal_route()' #94
Labels
bug
Something isn't working
Comments
Timezone and time are now correct: library(sf)
#> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1
library(hereR)
# Timestamp with different timezone as my local CET
(datetime = as.POSIXct("2020-12-17 08:00:00", tz = "Europe/Moscow"))
#> [1] "2020-12-17 08:00:00 MSK"
connection(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://transit.router.hereapi.com/v8/routes?...'
#> Received 1 response(s) with total size: 118.7 Kb
#> [1] "2020-12-17 08:53:00 MSK"
intermodal_route(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://intermodal.router.hereapi.com/v8/routes?...'
#> Received 1 response(s) with total size: 59.5 Kb
#> [1] "2020-12-17 08:53:00 MSK"
route(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://route.ls.hereapi.com/routing/7.2/calculateroute.json?...'
#> Received 1 response(s) with total size: 49.9 Kb
#> [1] "2020-12-17 08:00:00 MSK"
route_matrix(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://matrix.route.ls.hereapi.com/routing/7.2/calculatematrix.json?...'
#> Received 1 response(s) with total size: 712 bytes
#> [1] "2020-12-17 08:00:00 MSK"
isoline(poi[1, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://isoline.router.hereapi.com/v8/isolines?...'
#> Received 1 response(s) with total size: 9.7 Kb
#> [1] "2020-12-17 08:00:00 MSK"
# Timestamp with my local timezone (CET)
(datetime = as.POSIXct("2020-12-17 08:00:00", tz = "Europe/Zurich"))
#> [1] "2020-12-17 08:00:00 CET"
connection(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://transit.router.hereapi.com/v8/routes?...'
#> Received 1 response(s) with total size: 119.8 Kb
#> [1] "2020-12-17 08:49:00 CET"
intermodal_route(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://intermodal.router.hereapi.com/v8/routes?...'
#> Received 1 response(s) with total size: 74.1 Kb
#> [1] "2020-12-17 08:49:00 CET"
route(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://route.ls.hereapi.com/routing/7.2/calculateroute.json?...'
#> Received 1 response(s) with total size: 49.9 Kb
#> [1] "2020-12-17 08:00:00 CET"
route_matrix(poi[1, ], poi[2, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://matrix.route.ls.hereapi.com/routing/7.2/calculatematrix.json?...'
#> Received 1 response(s) with total size: 712 bytes
#> [1] "2020-12-17 08:00:00 CET"
isoline(poi[1, ], datetime = datetime)$departure[1]
#> Sending 1 request(s) to: 'https://isoline.router.hereapi.com/v8/isolines?...'
#> Received 1 response(s) with total size: 8.6 Kb
#> [1] "2020-12-17 08:00:00 CET" |
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since the fix of the timezone issue in
isoline()
(see #85), there is now an incorrect shift in the arrival and departure time ofconnection()
andintermodal_route()
. This occurs due the change in.encode_datetime
, which now encodes the timezone instead of converting to UTC before sending the request. Theconnection()
andintermodal_route()
functions still assume a timestamp in timezone UTC in the response from the API. So there occurs a shift in time:The functions
route()
,route_matrix()
andisoline()
are handling the timestamps correctly (as they are not taking the timestamp from the the API response):The
.parse_datetime()
helper function that causes the problem can not be replaced, as other functions (incident()
andweather()
) still use older API versions and receive UTC timestamps. Adding a.parse_datetime_tz()
that also parses the timezone information would solve the problem.Session info
The text was updated successfully, but these errors were encountered: