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
New isochrone function #123
Comments
I'd argue against using all network vertices as default for
|
I agree that it would be much simple if the user would pass a |
I've never used isochrone functions in any other packages, but apparently |
sure but you define one way or the other a resolution and you have to
sample points to determine the isochrone
nodes could be a good proxy for high resolution
Le lun. 26 oct. 2020 à 20:47, dhersz <notifications@github.com> a écrit :
… I've never used isochrone functions in any other packages, but apparently
ropensci/opentripplanner relies in a built-in OTP isochrone API
<https://github.com/ropensci/opentripplanner/blob/master/R/otp-isochrone-batch.R>.
There's no need to pass any destinations as a parameter, only origins.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#123 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANA2KEJJXNRTAXT3FSM7E4DSMXG4DANCNFSM4S6V3L2A>
.
|
A few thoughts: I like @rafapereirabr idea of using the street vertices as destinations in isochrone calculation. I was thinking on how we could implement this feature without adding an extra dependency on H3 or other grid building system, and that could be a good solution. I also agree with @dhersz that calculations could get slow in big cities, since there are a lot of street vertices. But we would need to test it to be sure, because routing is done on the street network anyways. So, independent of how many destination points we set, all street vertices within the travel time cutoff will be visited by the algorithm. Of course, the resulting travel time matrix will be much larger for street vertices than for grid cells, so there may be an overhead in the memory exchange between Java and R. Finally, I've checked R5 codebase and it has a built-in isochrone function that works on a grid of square cells. It also converts the reachable cells into polygons for each travel time cutoff. I just didn't have time yet to check how to make it work. |
Hi everyone, recently at Conveyal we were looking in more detail into R5R. It appears that as described in this issue, you are using the point-to-point routing functions to find paths one at a time to a large number of destinations. As @mvpsaraiva mentioned above, R5 has optimized methods for this use case, and in fact this is the only way Conveyal Analysis typically uses R5. For a given origin, it computes a single shortest path tree, and then "propagates" that single tree out to a regularly spaced grid of sample points (the destinations). One such operation takes roughly the same amount of computation as a single point-to-point search. Using this one-to-many method, the number of destinations has very little effect on the computation time. Put differently, finding paths from one origin to N destinations separately (using point-to-point routing in a loop) takes k*N units of time (roughly linear in N), but using our usual method it takes k units of time (remains roughly constant at the time required for 1 destination). This means the computations are completed thousands or millions of times faster. Although it will require some additional work, I'd strongly encourage you to explore this option. We would have shared this earlier, but we incorrectly assumed you were using the one-to-many approach because we use it almost exclusively. In fact the point-to-point code is essentially obsolete at this point and there is a good chance we'll remove it in the near future. |
Hi Andrew,
indeed, I am using massively the point to point functionality massively.
What you (strongly) suggest would be a huge improvement on my way to use
r5. What is the function you need to call to use this one to many function
of r5 ?
Thanks for your interest,
Xavier Timbeau
Le ven. 15 janv. 2021 à 10:44, Andrew Byrd <notifications@github.com> a
écrit :
… Hi everyone, recently at Conveyal we were looking in more detail into R5R.
It appears that as described in this issue, you are using the
point-to-point routing functions to find paths one at a time to a large
number of destinations. As @mvpsaraiva <https://github.com/mvpsaraiva>
mentioned above, R5 has optimized methods for this use case, and in fact
this is the only way Conveyal Analysis typically uses R5.
For a given origin, it computes a single shortest path tree, and then
"propagates" that single tree out to a regularly spaced grid of sample
points (the destinations). One such operation takes roughly the same amount
of computation as a single point-to-point search. Using this one-to-many
method, the number of destinations has very little effect on the
computation time.
Put differently, finding paths from one origin to N destinations
separately (using point-to-point routing in a loop) takes k*N units of time
(roughly linear in N), but using our usual method it takes k units of time
(remains roughly constant at the time required for 1 destination). This
means the computations are completed thousands or millions of times faster.
Although it will require some additional work, I'd strongly encourage you
to explore this option. We would have shared this earlier, but we
incorrectly assumed you were using the one-to-many approach because we use
it almost exclusively. In fact the point-to-point code is essentially
obsolete at this point and there is a good chance we'll remove it in the
near future.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#123 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANA2KENG6WHUATKCT6DSGD3S2AFBPANCNFSM4S6V3L2A>
.
|
After an email exchange with @mvpsaraiva the situation is clearer. He clarified that travel_time_matrix() is using the one-to-many approach, while the one-to-one approach is used by detailed_itineraries(). We must have been looking at the latter and jumped to conclusions. We are in the process of making more path details available in the one-to-many code. When that is finished I expect it will be possible to produce your detailed itineraries to all destinations at once, increasing the speed. That change will probably be in the next release of R5. |
On the original topic of this issue, you don't want to use a convex hull - as there are closer areas that may not be accessible (i.e. isochrones may be concave). If you autogenerate a regular grid of destinations, you can use marching squares to generate vector isochrones, or with irregular points you can create a triangulated irregular network and generate contour lines from that (there may even be an R library). The isochrone drawing problem is identical to the problem of generating contour lines from elevation data, so it's well studied. |
For the record, I've used the example in our paper to create a vignette showing how to calculate and visualize isochrones using |
Kuan Butt has a nice post discussing Better Rendering of Isochrones from Network Graphs |
For the record, the osrmIsochrone{osrm} function uses a really nice and simple approach. This could be a good reference. |
Very low priority. closing this issue for now. |
New isochrone function added to dev version in #7f50df1. |
I have now finished a more mature version of the Here's an example of how the function works, calculating multiple isochrones for walking from the city center of Porto Alegre and considering multiple sample sizes.
|
I should add this function to the isochrone vignette in the next couple of days. |
Done in 607ed3b. |
I've written a first draft of the function, available in
r5r\r-package\tests_rafa\isochrone.R
. As it stands, the output is aPOINT sf
object with all nodes the transport network and the travel time estimate between the point of interest to each node.If we want the output to be a group of polygons, we'll need to create convex hull polygons from those points.
The funtion currently looks like this:
function
reprex
The text was updated successfully, but these errors were encountered: