Skip to content

Commit

Permalink
Fix bug with new surface lists
Browse files Browse the repository at this point in the history
  • Loading branch information
mem48 committed Oct 25, 2023
1 parent 0ff016d commit 6959040
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions R/otp-surface.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ parse_surface <- function(x, get_data){
#' OTP 1.x
#'
#' @param otpcon OTP connection object produced by otp_connect()
#' @param surface A suface list from otp_make_surface()
#' @param surface A surface list from otp_make_surface()
#' @return Returns a data.frame of travel times
#' @examples
#' \dontrun{
Expand All @@ -106,14 +106,14 @@ otp_surface_isochrone <- function(otpcon = NULL,
}

# Check for list
if(is.null(surface$id)){
stop("Can't find surface ID, have you provided a list of surface IDs?")
if(is.null(surface[[1]]$id)){
stop("Can't find surface ID")
}

surfaceUrl <- make_url(otpcon, type = "surfaces")
surfaceUrl <- paste0(surfaceUrl,
"/",
surface$id,
surface[[1]]$id,
"/raster")

# convert response content into text
Expand Down
2 changes: 1 addition & 1 deletion vignettes/Analyst.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ The function will return the travel times in seconds between the fromPlaces and

## Producing an isochrone from a surface

The surfaces can also be used to produce isochrones from a surface.
The surfaces can also be used to produce isochrones from a surface. Only one raster can be produced at a time. If you provide a list of surfaces only the first will be used.

```{r eval=FALSE}
isochone <- otp_surface_isochrone(otpcon, surfaceid)
Expand Down

0 comments on commit 6959040

Please sign in to comment.