Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions R/otp-isochrone-batch.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,23 @@ otp_isochrone <- function(otpcon = NA,
ncores = max(round(parallel::detectCores() * 1.25) - 1,1),
timezone = otpcon$timezone) {
# Check for OTP2
if (!is.null(otpcon$otp_version)) {
if (otpcon$otp_version >= 2.0 & otpcon$otp_version <= 2.1) {
stop("Isochrones are not supported by OTP v2.0-2.1. Consider using v1.5 or v2.2+.")
} else if (otpcon$otp_version >= 2.2) {
message("OTP v2.2+ experimentaly supports isochrones, see https://docs.opentripplanner.org/en/v2.4.0/sandbox/TravelTime/")
if (!is.null(otpcon$otp_version) && otpcon$otp_version >= 2.0) {
if (otpcon$otp_version >= 2.2 & otpcon$otp_version <= 2.5) {
message(
"OTP v2.2 to v2.5 support isochrones experimentally, see https://docs.opentripplanner.org/en/v2.5.0/sandbox/TravelTime/ . Starting with OTP 2.6 the support for isochrones has been removed."
)
} else {
stop(sprintf(
"Isochrones are not supported by OTP v%s. Please use OTP v2.2 to v2.5.",
otpcon$otp_version
))
}
}

# Warn about walking isochrones not being supported by OTP v2
if (otpcon$otp_version >= 2.0) {
if (length(mode) == 1 && mode == "WALK") {
warning("Walking-only isochrones are not supported by OTP v2. You can only use \"WALK,TRANSIT\". When set to \"WALK\" OTPv2 defaults to \"WALK,TRANSIT\". See https://docs.opentripplanner.org/en/v2.4.0/sandbox/TravelTime/")
warning("Walking-only isochrones are not supported by OTP v2. You can only use \"WALK,TRANSIT\". When set to \"WALK\" OTPv2 defaults to \"WALK,TRANSIT\". See https://docs.opentripplanner.org/en/v2.5.0/sandbox/TravelTime/")
}
}

Expand Down
35 changes: 19 additions & 16 deletions R/otp-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -577,24 +577,27 @@ otp_check_java <- function(otp_version = 1.5) {
}

if (otp_version >= 2.2) {
if (java_version >= 1.8 & java_version < 1.9) {
warning("You have OTP 2.2+ but the version of Java for OTP 1.x")
return(FALSE)
}

if (java_version == 11) {
warning("You have OTP 2.2+ but the version of Java for OTP 2.0 or 2.1")
return(FALSE)
}

if (java_version == 17) {
message("You have the correct version of Java for OTP 2.2+")
return(TRUE)
if (otp_version < 2.5) {
# OTP 2.2 to 2.4 require Java 17 or later.
if (java_version < 17) {
warning("OTP 2.2 to 2.4 require Java version 17 or later; you have version ", java_version)
return(FALSE)
} else {
message("You have the correct version of Java for OTP ", otp_version, " (requires Java 17 or later)")
return(TRUE)
}
} else {
# OTP 2.5 or later require Java 21 or later.
if (java_version < 21) {
warning("OTP 2.5+ require Java version 21 or later; you have version ", java_version)
return(FALSE)
} else {
message("You have the correct version of Java for OTP ", otp_version, " (requires Java 21 or later)")
return(TRUE)
}
}

warning("OTP 2.2+ requires Java version 17 you have version ", java_version)
return(FALSE)
}


warning("OTP requires Java version 1.8 you have version ", java_version)
return(FALSE)
Expand Down
Loading