GeoLocation Methods
LightOSM.distance — Functiondistance(A::Union{Vector{GeoLocation}, GeoLocation, Vector{<:Node}, Node, Vector{<:AbstractFloat}},
B::Union{Vector{GeoLocation}, GeoLocation, Vector{<:Node}, Node, Vector{<:AbstractFloat}},
type::Symbol=:haversine
)Calculates the distance (km) between two points or two vectors of points.
Arguments
A::Union{Vector{GeoLocation}, GeoLocation, Vector{<:Node}, Node, Vector{<:AbstractFloat}}: Vector of origin points.B::Union{Vector{GeoLocation}, GeoLocation, Vector{<:Node}, Node, Vector{<:AbstractFloat}}: Vector of destination points.method::Symbol=:haversine: Either:haversineor:euclidean.
Return
- Distance between origin and destination points in km.
LightOSM.heading — Functionheading(a::GeoLocation, b::GeoLocation, return_units::Symbol=:degrees)
heading(a::Node, b::Node, return_units::Symbol=:degrees)
heading(A::Vector{GeoLocation}, B::Vector{GeoLocation}, return_units::Symbol=:degrees)
heading(A::Vector{Node}, B::Vector{Node}, return_units::Symbol=:degrees)Calculates heading(s) / bearing(s) between two points (a is origin, b is destination) or two vectors of points (A is vector of origins, B is vector of destinations). Points can be either GeoLocations or Nodes.
Depending on the return_units chosen, the return angle is in range of [-π, π] if :radians or [-180, 180] if :degrees. Additionally, adjusts destination longitude in case the straight line path between a and b crosses the International Date Line.
LightOSM.calculate_location — Functioncalculate_location(origin::GeoLocation, heading::Number, distance::Number)
calculate_location(origin::Node, heading::Number, distance::Number)
calculate_location(origin::Vector{GeoLocation}, heading::Vector{<:Number}, distance::Vector{<:Number})
calculate_location(origin::Vector{Node}, heading::Vector{<:Number}, distance::Vector{<:Number})Calculates next location(s) given origin GeoLocation(s) or Node(s), heading(s) (degrees) and distance(s) (km).
Locations are returned as GeoLocations.
LightOSM.to_cartesian — Functionto_cartesian(lat::T, lon::T, r::T) where {T}
to_cartesian(location::GeoLocation)
to_cartesian(locations::Vector{GeoLocation})Converts a vector of GeoLocations to (x, y, z) cartesian coordinates (based on radius of the Earth).
LightOSM.bounding_box_from_point — Functionbounding_box_from_point(point::GeoLocation, radius::Number)::NamedTupleCalculates the coordinates of the bounding box given a centroid point and radius (km).
Arguments
point::GeoLocation: Centroid of the bounding box as an GeoLocation.radius::Number: Radius in km of the bounding box (to each corner).
Return
NamedTuple: Named tuple with attributes minlat, minlon, maxlat, right_lon.