DeloitteOptimalReality / LightOSM.jl

A Julia package for downloading and analysing geospatial data from OpenStreetMap APIs.
https://deloitteoptimalreality.github.io/LightOSM.jl/docs
Other
48 stars 13 forks source link

Change `nearest_node` API #45

Closed mmiller-max closed 2 years ago

mmiller-max commented 3 years ago

Unfortunately this will be a breaking change, so we should aim to release it along with any others (if there are any in the pipeline)

If only one nearest node is requested, the output should not be a vector. Currently this is the output:

julia> nearest_node(g, 1)
([[2]], [[0.1]])

And I think the output should be

julia> nearest_node(g, 1)
(2, 0.1)

Then if more points are requested

julia> nearest_node(g, 1, 2)
([2, 3], [0.1,0.1])

And if more locations are given

julia> nearest_node(g, [1, 4], 2)
([[2, 3],[5, 6]], [[0.1,0.1],[0.1,0.1]])

Unfortunately that makes it type unstable. Could have nearest_node and nearest_nodes potentially?

Datseris commented 2 years ago

Yes, having nearest_node and nearest_nodes is the best way forwards in terms of design.