Nearest Node

LightOSM.nearest_nodeFunction
nearest_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 a GeoLocation or [lat, lon, alt], or a Vector of such points

Return

  • Tuple of neighbours and straight line euclidean distances from each point ([neighbours...], [dists...]). Tuple elements are Vectors if a Vector of points is inputted, and numbers if a single point is inputted.
source
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 or Vector of nodes specified by Node objects or id.

Return

  • Tuple of neighbours and straight line euclidean distances from each node ([neighbours...], [dists...]). Tuple elements are Vectorsif a Vector of nodes is inputted, and numbers if a single point is inputted.
source
LightOSM.nearest_nodesFunction
nearest_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 a GeoLocation or [lat, lon, alt], or a Vector of such points
  • 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 are Vector{Vector} if a Vector of points is inputted, and Vector if a single point is inputted.
source
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 or Vector of nodes specified by Node 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 are Vector{Vector} if a Vector of points is inputted, and Vector if a single point is inputted.
source