Replies: 7 comments 1 reply
-
Hi @swaheera, After reviewing your code I see a couple of issues.
If hope you don't mind that I convert this issue to a discussion. If you have any question we can discuss there 😄 |
Beta Was this translation helpful? Give feedback.
-
@loreabad6 : thank you so much for your answer! I really appreciate it! |
Beta Was this translation helpful? Give feedback.
-
@loreabad6 : Based on the comments and suggestions you kindly provided, would this be the correct way to do this?
Is this correct? |
Beta Was this translation helpful? Give feedback.
-
Here is the comparison with OSRM:
|
Beta Was this translation helpful? Give feedback.
-
There appears to be some differences in the path lengths from OSRM approach vs the shapefile approach:
|
Beta Was this translation helpful? Give feedback.
-
Hi @swaheera, yes probably the answers are different given taht osrm uses profiles for their computaiton. As you have set it to car, it must be using only roads that allow car usage. With sfnetworks you use the whole network. You can of course also set this profiles for yourself by subsetting the network and so on. A bit more fidling with the package will give you more possibilities. |
Beta Was this translation helpful? Give feedback.
-
I am trying to calculate the driving distance (e.g. based on road networks) between two sets of coordinates.
For example:
To solve this problem, I tried to download the shapefile for the Canadian Road Network and subset it for the Province of Ontario:
Then, by consulting different references (e.g. https://cran.r-project.org/web/packages/sfnetworks/vignettes/sfn01_structure.html) - I tried to calculate the distance between these two points:
But I get the following error:
Error in UseMethod("st_geometry") : no applicable method for 'st_geometry' applied to an object of class "c('tbl_df', 'tbl', 'data.frame')"
Can someone please show me how to fix this problem?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions