Nearest Node
LightOSM.nearest_node
— Functionnearest_node(g::OSMGraph, point::GeoLocation)
nearest_node(g::OSMGraph, points::Vector{GeoLocation})
nearest_node(g::OSMGraph, point::AbstractVector{<:AbstractFloat})
nearest_node(g::OSMGraph, points::AbstractVector{<:AbstractVector{<:AbstractFloat}})
Finds the nearest node from a point (specified by a GeoLocation
or set of Latitude Longitude coordinates) or Vector
of points using a NearestNeighbors.jl
KDTree.
Arguments
g::OSMGraph
: Graph container.point
/points
: Single point as aGeoLocation
or[lat, lon, alt]
, or aVector
of such points
Return
- Tuple of neighbours and straight line euclidean distances from each point
([neighbours...], [dists...])
. Tuple elements areVector
s if aVector
of points is inputted, and numbers if a single point is inputted.
nearest_node(g::OSMGraph, node::Node)
nearest_node(g::OSMGraph, nodes::Vector{<:Node})
nearest_node(g::OSMGraph, node_ids::AbstractVector{<:Integer})
nearest_node(g::OSMGraph, node_id::Integer)
Finds the nearest node from a node (specified by the Node
object or node id) or Vector
of nodes using a NearestNeighbors.jl
KDTree. The origin node itself is not included in the results.
Arguments
g::OSMGraph
: Graph container.node
/nodes
/node_id
/node_ids
: Single node orVector
of nodes specified byNode
objects or id.
Return
- Tuple of neighbours and straight line euclidean distances from each node
([neighbours...], [dists...])
. Tuple elements areVector
sif aVector
of nodes is inputted, and numbers if a single point is inputted.
LightOSM.nearest_nodes
— Functionnearest_nodes(g::OSMGraph, point::GeoLocation, n_neighbours::Integer=1)
nearest_nodes(g::OSMGraph, points::AbstractVector{GeoLocation}, n_neighbours::Integer=1)
nearest_nodes(g::OSMGraph, point::AbstractVector{<:AbstractFloat}, n_neighbours::Integer=1)
nearest_nodes(g::OSMGraph, points::AbstractVector{<:AbstractVector{<:AbstractFloat}}, n_neighbours::Integer=1)
Finds nearest nodes from a point or Vector
of points using a NearestNeighbors.jl
KDTree.
Arguments
g::OSMGraph
: Graph container.point
/points
: Single point as aGeoLocation
or[lat, lon, alt]
, or aVector
of such pointsn_neighbours::Integer
: Number of neighbours to query for each point.
Return
- Tuple of neighbours and straight line euclidean distances from each point
([[neighbours]...], [[dists]...])
. Tuple elements areVector{Vector}
if aVector
of points is inputted, andVector
if a single point is inputted.
nearest_nodes(g::OSMGraph, node_id::DEFAULT_OSM_ID_TYPE, n_neighbours::Integer=1)
nearest_nodes(g::OSMGraph, node_ids::Vector{<:DEFAULT_OSM_ID_TYPE}, n_neighbours::Integer=1)
nearest_nodes(g::OSMGraph, node::Node, n_neighbours::Integer=1)
nearest_nodes(g::OSMGraph, nodes::AbstractVector{<:Node}, n_neighbours::Integer=1)
Finds nearest nodes from a point or Vector
of points using a NearestNeighbors.jl
KDTree.
Arguments
g::OSMGraph
: Graph container.node
/nodes
/node_id
/node_ids
: Single node orVector
of nodes specified byNode
objects or id.n_neighbours::Integer
: Number of neighbours to query for each point.
Return
- Tuple of neighbours and straight line euclidean distances from each point
([[neighbours]...], [[dists]...])
. Tuple elements areVector{Vector}
if aVector
of points is inputted, andVector
if a single point is inputted.