Getting error in Coordinates :Error in request(headers = c(..., .headers)) : is.character(headers) is not TRUE

coordinates <- data.frame(lon = c(8.34234, 8.34423), lat = c(48.23424, 48.26424))
route<-ors_directions(coordinates, profile = ors_profile(),
format = c(“geojson”),api_key = api,
output = c(“sf”),)

Hi @DJSUBHAOO7,

Could you please give a bit more info about your problem?
It looks like you are trying to call ORS from an R script.
Are you using the openrouteservice-r SDK ?
You might need to specify some headers for it to work.
like Content-Type: application/json; charset=utf-8 and Accept: application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8

If it’s a problem with the SDK please create an issue in the repository

Best regards

@amandus
Yes please tell me how and where to put this header ?
I am confused with this header

Hey @DJSUBHAOO7,

Sorry but this is not a problem with openrouteservice then.
If you are having trouble setting a header for a request in R, try using a search engine and search for ‘how to do GET/POST requests and setting headers in R’, please.

Best regards

@amandus
Thank you sir, This is solved but a new one here ,
route<-ors_directions(list(c(88.30757,23.43219), c(87.29786,22.43199)))
leaflet() %>%
addTiles() %>%
addGeoJSON(route, fill=FALSE) %>%
fitBBox(route$bbox)

Error: Openrouteservice API request failed
[2010] Could not find point 0: 88.3075700 23.4321900 within a radius of 350.0 meters.

@amandus
Sir, I understand what you want to show me but how I did this in R ?
Where I define the radius ?

@amandus
Sir,`

route<-ors_directions(coordinates,radiuses=c(500,350))
this is working

`

But the problem is showing a long route even when a short route is present


What have to do for that ?

This might be a oneway, so depending on your driving direction you might not be allowed to use this way.
You can check this by inspecting the osm object on openstreetmap.org
If this way was introduced just recently it might not be in the routing graph yet. You can also check when the way was created.

Cross posted: https://github.com/GIScience/openrouteservice-r/issues/62