Comments (4)
Thank you.
I'm not sure about how to pass this option to curl::handle_setopt()
. Do you have an example?
from osrm.
osrmTable <- function (src, dst = src, loc, exclude, measure = "duration",
osrm.server = getOption("osrm.server"), osrm.profile = getOption("osrm.profile"), ...)
{
opt <- options(error = NULL)
on.exit(options(opt), add = TRUE)
url <- base_url(osrm.server, osrm.profile, "table")
if (!missing(loc)) {
loc <- input_table(x = loc, id = "loc")
dst_r <- src_r <- loc
url <- paste0(url, encode_coords(x = loc, osrm.server = osrm.server),
"?")
}
else {
src_r <- input_table(x = src, id = "src")
dst_r <- input_table(x = dst, id = "dst")
loc <- rbind(src_r, dst_r)
url <- paste0(url, encode_coords(x = loc, osrm.server),
paste0("?sources=", paste(0:(nrow(src_r) - 1), collapse = ";"),
"&destinations=", paste(nrow(src_r):(nrow(loc) -
1), collapse = ";")), "&")
}
if (!missing(exclude)) {
url <- paste0(url, "exclude=", exclude, "&")
}
url <- paste0(url, "annotations=", paste0(measure, collapse = ","),
"&generate_hints=false")
e <- try({
req_handle <- curl::new_handle(verbose = FALSE)
curl::handle_setopt(req_handle, useragent = "osrm_R_package", ...)
r <- curl::curl_fetch_memory(utils::URLencode(url), handle = req_handle)
}, silent = TRUE)
if (inherits(e, "try-error")) {
stop(e, call. = FALSE)
}
test_http_error(r)
res <- RcppSimdJson::fparse(rawToChar(r$content))
output <- list()
if (!is.null(res$durations)) {
output$durations <- tab_format(res = res, src = src_r,
dst = dst_r, type = "duration")
}
if (!is.null(res$distances)) {
output$distances <- tab_format(res = res, src = src_r,
dst = dst_r, type = "distance")
}
coords <- coord_format(res = res, src = src_r, dst = dst_r)
output$sources <- coords$sources
output$destinations <- coords$destinations
return(output)
}
from osrm.
Ah ah, no I know how to pass the ellipsis 😄 .
Sorry I wasn't clear, what I meant was that I don't know how to pass the "CURL_MAX_HTTP_HEADER" option to curl
. I haven't seen an example of this and I'm not sure if this parameter is exposed through curl::handle_setopt()
.
from osrm.
Related Issues (20)
- Difference between `osrmRoute` and `osrmTrip`
- Distance between multiple pairs of points? HOT 1
- How can I remove alternate routes when using osrm package in leaflet(r)? HOT 1
- Improve error handling osrmIsochrone(): out of bounds
- Improve error handling `osrmIsochrone()`: character vector of location HOT 1
- Improve error handling `osrmIsochrone()`: handle empty isochrones
- Improve documentation `osrmIsochrone()`: `breaks` argument
- Define "isometric" and "isodistance"
- Speed parameter HOT 3
- Stop osrm "connecting" to the network via certain types of roads HOT 6
- Problem with input data and osrmTrip() HOT 3
- curl::curl_fetch_memory(utils::URLencode(url) => connection was reset HOT 4
- osrmIsochrone(): 'loc' is too far from the OSRM network but loc is not too far... HOT 9
- Error in `osrmTrip()` when location coordinates are close to each other and/or not on roads HOT 2
- pairwise distance matrix from OSRM? HOT 2
- Using custom driving profiles HOT 2
- Problem with self-hosted server connection HOT 11
- fix pkg level documentation
- Duration of trip in osrmRoute and time of the day/traffic HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osrm.