R/utils.R

Defines functions is_request_error set_gh_class as_point_str point_str

point_str <- function(point) {
  .Deprecated("as_point_str")
  paste0(point, collapse = ",")
}

as_point_str <- function(point) {
  paste0(point, collapse = ",")
}

set_gh_class <- function(x, class_name = c("gh_route", "gh_spt", "gh_info", "gh_isochrone")) {
  structure(x, class = c(match.arg(class_name), class(x)))
}

#toJSON_fromJSON <- function(item) {
#  jsonlite::toJSON(item, auto_unbox = TRUE) %>%
#    jsonlite::fromJSON()
#}

#toJSON_st_read <- function(item) {
#  jsonlite::toJSON(item, auto_unbox = TRUE) %>%
#    sf::st_read(quiet = TRUE)
#}

is_request_error <- function(response) {
  if (response$status != 200) {
    warning("Something went wrong. Returning (raw) response object.")
    return(TRUE)
  }

  FALSE
}

Try the graphhopper package in your browser

Any scripts or data that you put into this service are public.

graphhopper documentation built on Feb. 6, 2021, 5:05 p.m.