Skip to content

Commit

Permalink
Merge branch 'ropensci:master' into otp_v2
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kotov authored Jun 3, 2024
2 parents 53e53e8 + e3db5fd commit f375383
Show file tree
Hide file tree
Showing 12 changed files with 43 additions and 25 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ jobs:
if: runner.os == 'macOS'
run: |
# conflicts with gfortran from r-lib/actions when linking gcc
rm '/usr/local/bin/gfortran'
brew install pkg-config gdal proj geos
# rm '/usr/local/bin/gfortran' # Now Failing
# brew install pkg-config gdal proj geos
brew install gdal proj
- name: Query dependencies
run: |
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

* Fixed bug in `otp_isochrone` when using `fromID`
* Slightly faster routing with large batches
* More mode choices in `otp_plan`
* More mode choices in `otp_plan` and `otp_isochrone`


# opentripplanner 0.5.1

Expand Down
16 changes: 9 additions & 7 deletions R/otp-isochrone-batch.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
#' data frame of POINTS
#' @param fromID character vector same length as fromPlace
#' @param mode character vector of one or more modes of travel valid values
#' TRANSIT, WALK, BICYCLE, CAR, BUS, RAIL, SUBWAY, TRAM, FERRY, BICYCLE_RENT,
#' BICYCLE_PARK, CAR_PARK, CABLE_CAR, GONDOLA, FUNICULAR, AIRPLANE, default
#' "TRANSIT","BUS", "RAIL", "SUBWAY","TRAM", "FERRY", "GONDOLA", "FUNICULAR",
#' "AIRPLANE", "CABLE_CAR", "WALK", "BICYCLE", "BICYCLE_RENT", "BICYCLE_PARK",
#' "CAR", "CAR_PARK", "CAR_HAIL", "CARPOOL", "CAR_DROPOFF", "CAR_PICKUP", default
#' CAR. Not all combinations are valid e.g. c("WALK","BUS") is valid but
#' c("WALK","CAR") is not.
#' @param date_time POSIXct, a date and time, defaults to current
Expand Down Expand Up @@ -73,11 +74,12 @@ otp_isochrone <- function(otpcon = NA,
mode <- toupper(mode)
checkmate::assert_subset(mode,
choices = c(
"TRANSIT", "WALK", "BICYCLE",
"CAR", "BUS", "RAIL", "SUBWAY",
"TRAM", "FERRY","BICYCLE_RENT",
"BICYCLE_PARK","CAR_PARK","CABLE_CAR",
"GONDOLA","FUNICULAR","AIRPLANE"
"TRANSIT","BUS", "RAIL", "SUBWAY","TRAM", "FERRY",
"GONDOLA","FUNICULAR","AIRPLANE","CABLE_CAR",
"WALK",
"BICYCLE","BICYCLE_RENT","BICYCLE_PARK",
"CAR","CAR_PARK",
"CAR_HAIL","CARPOOL","CAR_DROPOFF","CAR_PICKUP"
),
empty.ok = FALSE
)
Expand Down
12 changes: 12 additions & 0 deletions R/otp-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,18 @@ otp_checks <- function(otp = NULL,
} else {
return(FALSE)
}

if(otp_version >= 2){
fls_zip <- list.files(file.path(dir, "/graphs/", router), pattern = ".zip")
if(length(fls_zip) > 0){
if(any(!grepl("gtfs",fls_zip))){
warning(".zip files detected that are not .gtfs.zip, OTP 2.X will ignore these files")
}
}
}



}


Expand Down
5 changes: 3 additions & 2 deletions man/otp_isochrone.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/otp_plan.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/otp_surface_isochrone.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test_02_without_OTP.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ test_that("otp_isochrone input validation", {
)
skip_on_cran()
expect_error(otp_isochrone(otpcon, fromPlace = c(1, 1)),
regexp = "No results returned, check your connection"
regexp = "No results returned, check your connection|Failed to connect to localhost"
)
})

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_03_with_OTP.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ test_that("transit routing", {
route <- otp_plan(otpcon,
fromPlace = c(-1.16489, 50.64990),
toPlace = c(-1.15803, 50.72515),
date_time = as.POSIXct(strptime("2022-06-03 13:30", "%Y-%m-%d %H:%M")),
date_time = as.POSIXct(strptime("2024-06-03 13:30", "%Y-%m-%d %H:%M")),
mode = c("WALK", "TRANSIT"),
numItineraries = 3
)
Expand Down
6 changes: 3 additions & 3 deletions vignettes/OTPv2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ It is possible to install multiple version of Java on the same computer:

**Download Links**

* [Java 8](https://www.java.com/en/download/manual.jsp)
* [Java 11](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html)
* [Java 17](https://www.oracle.com/java/technologies/downloads/#java17)
* [Java 8](https://www.java.com/en/download/)
* [Java 11](https://www.oracle.com/uk/java/technologies/javase/jdk11-archive-downloads.html)
* [Java 17](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)

If you have multiple version of Java installed you will also need to change the PATH variable to point to the correct version of Java. You can check your current default version of Java in the terminal using

Expand Down
2 changes: 1 addition & 1 deletion vignettes/opentripplanner.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ OTP can use public transport timetable data in the [GTFS format](https://develop

#### Elevation Data

You can add terrain information to your routes, especially useful for walking and cycling, using [GeoTIFF images](https://trac.osgeo.org/geotiff). You can find worldwide elevation data from [NASA](https://www2.jpl.nasa.gov/srtm/).
You can add terrain information to your routes, especially useful for walking and cycling, using [GeoTIFF images](https://trac.osgeo.org/geotiff). You can find worldwide elevation data from [NASA](https://www.usgs.gov/centers/eros/science/usgs-eros-archive-digital-elevation-shuttle-radar-topography-mission-srtm-non#overview).

**Warning** It is common for GeoTIFF to have a no data value often the maximum possible value. OTP can misinterpret this as an elevation value. So set your no data values in your elevation data to something more plausible like 0.

Expand Down
6 changes: 3 additions & 3 deletions vignettes/prerequisites.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ This package allows you to use the trip planning power of OTP with the analytica

The `opentripplanner` R package makes it easier for R and OpenTripPlanner to communicate.
Specifically, it allows you to do use R to control OTP and use it as a local routing service.
For more on local versus remote routing services, see the Transportation chapter in [Geocomputation with R](https://geocompr.robinlovelace.net/transport.html).
For more on local versus remote routing services, see the Transportation chapter in [Geocomputation with R](https://r.geocompx.org/transport.html).

### What are R and RStudio?

Expand All @@ -37,7 +37,7 @@ An R package is a small piece of software that extends the basic capabilities of

### Help with R

To get started with R, see [An Introduction to R](https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf) or from within R by running `help.start()`, introductory tutorials such as DataCamp's free Introduction to R course, or the [R tutor website](https://www.r-tutor.com/r-introduction). The [Geocomputation with R](https://geocompr.robinlovelace.net) book covers the packages and skills required to analyse spatial datasets such as those produced by OpenTripPlanner.
To get started with R, see [An Introduction to R](https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf) or from within R by running `help.start()`, introductory tutorials such as DataCamp's free Introduction to R course, or the [R tutor website](https://www.r-tutor.com/r-introduction). The [Geocomputation with R](https://r.geocompx.org/) book covers the packages and skills required to analyse spatial datasets such as those produced by OpenTripPlanner.

A video tutorial for installing R and RStudio

Expand Down Expand Up @@ -103,7 +103,7 @@ The package includes a simple function for checking if you have the correct vers

To get Java:

* **Windows/Mac** https://www.java.com/en/download/ This link defaults to the 32 Bit version, so also check https://java.com/en/download/manual.jsp.
* **Windows/Mac** https://www.java.com/en/download/ This link defaults to the 32 Bit version, so also check https://www.java.com/en/download/help/java_win64bit.html.

* **Linux** we recommend instructions at [StackOverflow](https://askubuntu.com/questions/740757/switch-between-multiple-java-versions).

Expand Down

0 comments on commit f375383

Please sign in to comment.