Check if all the parameters are valid for the knn functions
sanity_check_knn(
origins,
destinations,
lines,
k,
maxdistance,
snap_dist,
line_weight,
direction,
grid_shape,
verbose,
digits,
tol
)
A SpatialPointsDataFrame, for each point, its k nearest neighbours will be found on the network.
A SpatialPointsDataFrame, might be used if the neighbours must be found in a separate dataset. NULL if the neighbours must be found in origins.
A SpatialLinesDataFrame representing the network
An integer indicating the number of neighbours to find..
The maximum distance between two observations to consider them as neighbours. It is useful only if a grid is used, a lower value will reduce calculating time, but one must be sure that the k nearest neighbours are within this radius. Otherwise NAs will be present in the final matrices.
The maximum distance to snap the start and end points on the network.
The weighting to use for lines. Default is "length" (the geographical length), but can be the name of a column. The value is considered proportional to the geographical length of the lines.
Indicates a field providing information about authorized travelling direction on lines. if NULL, then all lines can be used in both directions. Must be the name of a column otherwise. The values of the column must be "FT" (From - To), "TF" (To - From) or "Both".
A vector of length 2 indicating the shape of the grid to use for splitting the dataset. Default is c(1,1), so all the calculation is done in one go. It might be necessary to split it if the dataset is large.
A Boolean indicating if the function should print its progress
The number of digits to retain in the spatial coordinates ( simplification used to reduce risk of topological error)
A float indicating the spatial tolerance when points are added as vertices to lines.
A list with two matrices, one with the index of the neighbours and one with the distances.
# NOT RUN {
#no example provided, this is an internal function
# }
Run the code above in your browser using DataLab