Skip to content
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

Network k_cross_function: Error Points are snapped to the exact same location #23

Open
ThomasX94 opened this issue Jun 13, 2024 · 1 comment

Comments

@ThomasX94
Copy link

Thank you for your work.
I got a set of hard braking events and police reported traffic accidents.
Now i want to test with the network-k-cross function if hard braking events are clustered around accidents and vice versa.
However no matter how low i set the agg parameter i always get the following Error:
Error in cross_kfunctions(main_network_mtl, bike_accidents, mtl_libraries, :
After snapping the points on the network, some of them share the same location.
To correct it, please consider setting or increasing the value of the parameter agg.
They will be merged and their weights added

I also get this error message when using the bike accidents data sample provided by spNetwork in this example:
result <- cross_kfunctions(main_network_mtl, bike_accidents, mtl_libraries,
start = 0, end = 200, step = 10, width = 15,
nsim = 50, conf_int = 0.05, digits = 2,
tol = 0.1,verbose = FALSE, agg=NULL)

@JeremyGelb
Copy link
Owner

Hello !

Indeed, I did not have a lot of time to spend on this function. The error is raised because this functions is not well adapted for the moment to data that share the exact same location on the network.

Indeed, events at the same location will have a distance of 0 between them. The error is raised when points share the same location after been projected on the network. The error message suggest to INCREASE the value of agg. By doing it, you will merge close points before snapping them on the network and reduce the change to get this error.

I will try to implement soon a solution where points at the same location on the network are merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants