Closed mem48 closed 2 months ago
New function points_to_od_maxdist that uses nngeo to get the nearest neighbours
Big :+1: to use of nngeo
.
Also adds support for projected coordinates and the ability to look for the nearest X regardless of distance.
Shouldn't that functionality be in the {od}
package, easy to be upstreamed?
10,000 * 10,000 LSOAs with max_dist = 5000 took 29 seconds
35,672 * 35,672 LSOAs with max_dist = 5000 took 4.9 minutes
:rocket:
Also adds support for projected coordinates and the ability to look for the nearest X regardless of distance.
Shouldn't that functionality be in the
{od}
package, easy to be upstreamed?
Possibly yes, I was working here to get things working but file could easily be moved
This belongs upstream: https://github.com/ITSLeeds/od/issues/18
@Robinlovelace some work in progress
The goal is faster performance on large datasets.
Changes are:
1) New function points_to_od_maxdist that uses
nngeo
to get the nearest neighbours rather than creating the full matrix. Also adds support for projected coordinates and the ability to look for the nearest X regardless of distance. Could be useful when mixing rural and urban areas, where say 5000m is a long way to go for a shop in an urban area but a short distance in a rural area. Should be much faster for very large numbers of origins and destinations and less likely to run out of memory.2) Tweaked
si_calculate
andsi_predict
that usedata.table
and avoid copying data when possible. Slight breaking change asconstraint_production
now needs to be a quoted character. I couldn't figure out thedplyr
syntax, so welcome suggestions on a fix.Example