UrbanAnalyst / dodgr

Distances on Directed Graphs in R
https://urbananalyst.github.io/dodgr/
128 stars 16 forks source link

document need to ensure CRS = 4326 #114

Closed mpadge closed 3 years ago

mpadge commented 5 years ago

This is currently assumed, but nowhere explicitly stated. Need to do so, as highlighted by @agila5

mem48 commented 4 years ago

I have had some odd results when not using 4326, as it seems to work, but often when converting things back to sf for plotting a CRS of 4326 is enforced. Perhaps you can do a quick check on incoming CRS for functions like weight_streetnet.

My main reason for not using 4326 is needing more control over the snapping of from and to points to the graph. Most routing services will snap input point onto the nearest point on the graph, but only by a certain distance e.g. 100 m. But most dodgr functions only accept exact coordinates as inputs.

There is match_points_to_graph() but this has no control over maximum snapping distance, which can result in odd results. So I have to build my own point to vertex table using a package such as RANN in a projected CRS to get this kind of control.

My ideal solution would be for match_points_to_graph() to have a maxdist argument, and then all functions which accept input latitude and longitude coordinate to (optionally) call match_points_to_graph() first.