Skip to content
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] Set date and time for queries #111

Closed
jc-ulles opened this issue Oct 23, 2023 · 2 comments
Closed

[BUG] Set date and time for queries #111

jc-ulles opened this issue Oct 23, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@jc-ulles
Copy link

Hello,
When I launch an OTP session, the afternoon times are systematically converted to the morning. I've tried to change the settings but without success. I use OTP from France.
The code is as follows:

otp_setup(otp = path_otp, dir = path_data)
myOtpcon <- otp_connect(timezone = "Europe/Paris")

route <- otp_plan(otpcon=myOtpcon,
fromPlace = c(3.92320, 43.59586),
toPlace = c(3.91605, 43.60383),
mode = c("WALK", "TRANSIT"),
date_time = as.POSIXct("2023-10-23 21:00:00"))

The result in "startTime" and "endTime" is "2023-10-23 09:08:08" and "2023-10-23 09:18:15".
This result is good if I had indicated "2023-10-23 09:00:00" but not for "2023-10-23 21:00:00" as I would like.

I tried, without success, this :
date_time = as.POSIXct("2023-10-23 21:00", format = "%Y-%m-%d %H:%M")

I guess there's a problem with the time conversion, but I haven't been able to solve it.
Is there any way to request the afternoon?
I got the same issue with otp_isochrone().

I'm using the last version (0.5.1) and this GTFS.

Many thanks!

@jc-ulles jc-ulles added the bug Something isn't working label Oct 23, 2023
@jc-ulles
Copy link
Author

I found the solution in the #85, I changed my R settings with:
Sys.setlocale("LC_TIME","en_US.UTF-8")

@mem48
Copy link
Contributor

mem48 commented Oct 25, 2023

I suggest using the package lubridate when setting date_time as these kinds of timezone problems are common in R

@mem48 mem48 closed this as completed Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants