Comments (8)
I'll have a look, the error implies that the number of routes doesn't match the summary information which seems rather odd (and I'm sure this example worked when I tried it a few weeks ago).
from stplanr.
Thanks for the fix - no longer errors but I get some strange warnings and the output looks strange:
> exroutes <- viaroute(viapoints=list(data.frame(x=c(-33.5,-33.6,-33.7),y=c(150,150.1,150.2))))
> r <- viaroute2sldf(exroutes)
Warning messages:
1: In bind_rows_(x, .id) : Unequal factor levels: coercing to character
2: In bind_rows_(x, .id) : Unequal factor levels: coercing to character
3: In bind_rows_(x, .id) : Unequal factor levels: coercing to character
4: In bind_rows_(x, .id) : Unequal factor levels: coercing to character
plot(r)
from stplanr.
Compared with this from the osrm package:
install.packages("osrm")
library(osrm)
r_osrm <- osrmTrip(data.frame(i = 1:3,x=c(150,150.1,150.2),y=c(-33.5,-33.6,-33.7)))
plot(r_osrm[[1]]$trip)
from stplanr.
Also this seems to generate an error with the stplanr implementation:
origin = tmap::geocode_OSM("London")
destination = tmap::geocode_OSM("Leeds")
od_df = rbind(origin$coords, destination$coords)
exroutes <- viaroute(viapoints = list(od_df))
r <- viaroute2sldf(exroutes)
Error in data.frame(routenum = i, legnum = j, routedesc = rep(x$routes$legs[[i]]$summary[j], :
arguments imply differing number of rows: 1, 2, 0
Interestingly this also seems to fail with osrm:
ro = osrmRoute(origin, destination)
osrmRoute function returns an error:
Error: URL string malformed close to position 31: "73, 51"
from stplanr.
Update: it works with osrm: riatelab/osrm#17
from stplanr.
Reopening, seeing the same thing. I'll have another look.
from stplanr.
Any update on this @richardellison? Thinking better to fix bugs before adding new features and improving performance.
from stplanr.
This has been fixed in #161. The following now returns the correct geometries.
exroutes <- viaroute(viapoints=list(data.frame(x=c(-33.5,-33.6,-33.7),y=c(150,150.1,150.2))))
r <- viaroute2sldf(exroutes)
You will notice that this is different from the result returned by the osrm package. This is because the "osrm" package calculates the individual routes between each pair of coordinates while this implementation uses the coordinates as waypoints on a single route. To return the same result as the "osrm" package you can run the following:
exroutes2 <- viaroute(viapoints=list(
data.frame(x=c(-33.5,-33.7),y=c(150,150.2)),
data.frame(x=c(-33.6,-33.7),y=c(150.1,150.2))
))
r2 <- viaroute2sldf(exroutes2)
from stplanr.
Related Issues (20)
- Comparing the results between angle_diff with calculate_angle/get_vector HOT 1
- Error message in bind_sf
- CRAN issues
- bug in the rnet_merge function when defining the funs HOT 3
- Use different buffer options in `rnet_merge()`
- Convert large GeoJSON file to PMTiles HOT 1
- bug in geo_buffer HOT 7
- Possible speed enhancement to `mats2line()` HOT 3
- Invalid LineStrings in routes_fast_sf HOT 1
- Use `od::odc_to_sfc()` do the legwork in `mats2line()` HOT 3
- Bug in `line_segment()` when using certain values on projected data with `rsgeo` implementation HOT 8
- `rnet_merge()` fails when inputs are projected HOT 4
- `line_bearing()` is slow HOT 3
- Argument of segment_length in line_segment fun causes issue HOT 14
- Tried creating a route from desirelines using osrm function HOT 9
- rnet merge function can't not handle attributes containing strings HOT 1
- Add links to more papers in DESCRIPTION
- Re-add n_segments argument to line_segment() HOT 1
- `line_segment()` fails when n_segments has multiple values HOT 1
- od2line() throws an error if only one origin-destination relation is selected HOT 5
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 stplanr.