Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osrmTrip returns (non-numeric argument to binary operator #19

Closed
314a opened this issue Mar 13, 2017 · 1 comment
Closed

osrmTrip returns (non-numeric argument to binary operator #19

314a opened this issue Mar 13, 2017 · 1 comment

Comments

@314a
Copy link

314a commented Mar 13, 2017

In package osrm version 3.0.0
try:

data("com")
trips <- osrmTrip(loc = com[1101:1150, c(1,3,4)])

Error is on line 134-136 of file osrmTrip.R:

df <- data.frame(start, end,  
                       duration = res$trips[nt,]$legs[[1]][,3] / 60,  
                       distance = res$trips[nt,]$legs[[1]][,4] / 1000)

The distance column in the returned seems to have changed order in the json
Potential solution, replace 134-136 with

df <- data.frame(start, end, 
                       duration = res$trips[nt,]$legs[[1]][,3] / 60, 
                       distance = res$trips[nt,]$legs[[1]][,2] / 1000)

or alternatively

df <- data.frame(start, end, 
                       duration = res$trips[nt,]$legs[[1]][,"duration"] / 60, 
                       distance = res$trips[nt,]$legs[[1]][,"distance"] / 1000)
@rCarto
Copy link
Member

rCarto commented Mar 16, 2017

thank you very much ), I'll correct this quickly

@rCarto rCarto closed this as completed Mar 16, 2017
@rCarto rCarto reopened this Mar 16, 2017
@rCarto rCarto closed this as completed in e4ee9e7 Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants