Skip to content

Commit

Permalink
Merge pull request #168 from munterfi/167-bug-pedestrian-doesn´t-work…
Browse files Browse the repository at this point in the history
…-in-isoline

Avoid consumption model to be added to request when transport mode is…
  • Loading branch information
munterfi authored Oct 18, 2024
2 parents ceada1c + 692c566 commit 89f44dd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: hereR
Type: Package
Title: 'sf'-Based Interface to the 'HERE' REST APIs
Version: 1.0.0
Version: 1.0.1
Authors@R: c(
person("Merlin", "Unterfinger", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-2020-2366")),
person("Daniel", "Possenriede", role = "ctb", comment = c(ORCID = "0000-0002-6738-9845")))
Expand Down Expand Up @@ -39,5 +39,5 @@ Suggests:
License: GPL-3
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
RoxygenNote: 7.3.2
VignetteBuilder: knitr
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# version 1.0.1

- Avoid consumption model to be added to request when transport mode is pedestrian (closes [#167](https://github.com/munterfi/hereR/issues/167)).

# version 1.0.0

Please note that there are breaking changes introduced in this major version release for the `weather()`, `flow()`, and `incidents()` functions. Be sure to review the updated documentation to understand how these changes may affect your usage.
Expand Down
39 changes: 17 additions & 22 deletions R/isoline.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,30 +107,25 @@ isoline <- function(poi, datetime = Sys.time(), arrival = FALSE,
optimize
)

# Add consumption model if specified, otherwise set to default electric vehicle
if (is.null(consumption_model)) {
url <- paste0(
url,
"&ev[freeFlowSpeedTable]=0,0.239,27,0.239,45,0.259,60,0.196,75,0.207,90,0.238,100,0.26,110,0.296,120,0.337,130,0.351,250,0.351",
"&ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36",
"&ev[ascent]=9",
"&ev[descent]=4.3",
"&ev[auxiliaryConsumption]=1.8"
)
} else {
url <- paste0(
url,
consumption_model
)
if (transport_mode != "pedestrian") {
# Add consumption model if specified, otherwise set to default electric vehicle
if (is.null(consumption_model)) {
url <- paste0(
url,
"&ev[freeFlowSpeedTable]=0,0.239,27,0.239,45,0.259,60,0.196,75,0.207,90,0.238,100,0.26,110,0.296,120,0.337,130,0.351,250,0.351",
"&ev[trafficSpeedTable]=0,0.349,27,0.319,45,0.329,60,0.266,75,0.287,90,0.318,100,0.33,110,0.335,120,0.35,130,0.36,250,0.36",
"&ev[ascent]=9",
"&ev[descent]=4.3",
"&ev[auxiliaryConsumption]=1.8"
)
} else {
url <- paste0(
url,
consumption_model
)
}
}

# Add departure time
url <- .add_datetime(
url,
datetime,
if (arrival) "arrival" else "departure"
)

# Return urls if chosen
if (url_only) {
return(url)
Expand Down

0 comments on commit 89f44dd

Please sign in to comment.