Reference
Map plotting functions
OpenStreetMapXPlot.Style
— Typestruct Style{T}
color::T
width::Float64
spec::String
end
For most cases you will use constructor declared as:
Style(col, width, spec="-")
OpenStreetMapXPlot.plotmap
— Functionplotmap(nodes::Dict{Int,T},
bounds::Union{Nothing,OpenStreetMapX.Bounds{T}} = nothing;
buildings::Union{Nothing,Vector{OpenStreetMapX.Way}} = nothing,
buildingStyle::Styles=OpenStreetMapXPlot.Style("0x000000", 1, "-"),
roadways::Union{Nothing,Vector{OpenStreetMapX.Way}} = nothing,
roadwayStyle::Styles=OpenStreetMapXPlot.Style("0x007CFF", 1.5, "-"),
walkways::Union{Nothing,Vector{OpenStreetMapX.Way}} = nothing,
walkwayStyle::Styles=OpenStreetMapXPlot.Style("0x007CFF", 1.5, "-"),
cycleways::Union{Nothing,Vector{OpenStreetMapX.Way}} = nothing,
cyclewayStyle::Styles=OpenStreetMapXPlot.Style("0x007CFF", 1.5, "-"),
features::Union{Nothing,Dict{Int64,Tuple{String,String}}} = nothing,
featureStyle::Styles=OpenStreetMapXPlot.Style("0xCC0000", 2.5, "."),
width::Integer=600,
height::Integer=600,
fontsize::Integer=0,
km::Bool=false,
use_plain_pyplot::Bool=false
) where T<:Union{OpenStreetMapX.LLA,OpenStreetMapX.ENU}
Plots selected map features for a given dictionary of node locations (nodes
) and within the given bounds
. The km
parameter can be used to have a kilometer scale of the map instead of meters.
The default plotting backend is whatever is defined in Plots.jl
, however if the use_plain_pyplot
is set to true
Plots.pythonplot() will be called to switch to PythonPlot backend (note this option is depraciated and normally backend should be changed outside of this function).
Returns an object that can be used for further plot updates.
plotmap(m::OpenStreetMapX.MapData;
roadwayStyle = OpenStreetMapXPlot.LAYER_STANDARD,
width::Integer=600, height::Integer=600, use_plain_pyplot::Bool=false)
Plots roadways
for a given map m
.
The width will be set to width
and the height will be set to height
. If only one of width
or height
is set, the other will be set to perserve the aspect ratio of the bounding box. The km
parameter can be used to have a kilometer scale of the map instead of meters.
The default plotting backend is whatever is defined in Plots.jl
, however if the use_plain_pyplot
is set to true
Plots.pythonplot() will be called to switch to PythonPlot backend (note this option is depraciated and normally backend should be changed outside of this function).
Returns an object that can be used for further plot updates.
OpenStreetMapXPlot.addroute!
— Functionaddroute!(p, nodes::Dict{Int,T},
route::Vector{Int};
route_color::Union{String, Plots.RGB} ="0x000053",
km::Bool=false,
start_name="A", end_name="B",
fontsize=15
) where T<:Union{OpenStreetMapX.LLA,OpenStreetMapX.ENU}
Adds a route
to the plot p
using the node information stored in nodes
.
The first element from the list of nodes route
will be annoted by start_name
while the last will be annotated by end_name
. The km
parameter can be used to have a kilometer scale of the map instead of meters.
Returns an object that can be used for further plot updates.
addroute!(p, m::OpenStreetMapX.MapData,
route::Vector{OpenStreetMapX.LLA};
route_color::Union{String, Plots.RGB} ="0x000053",
km::Bool=false,
start_name="A", end_name="B",
fontsize=15
)
Adds a route
in LLA coordinates to the plot p
representing the map m
.
The first element from the list of route coordinates route
will be annoted by start_name
while the last will be annotated by end_name
. The km
parameter can be used to have a kilometer scale of the map instead of meters.
Returns an object that can be used for further plot updates.
OpenStreetMapXPlot.plot_nodes!
— Functionplot_nodes!(p, m::OpenStreetMapX.MapData,
nodeids::Vector{Int};
start_numbering_from::Union{Int,Nothing}=1,
km::Bool=false,
color="darkgreen",
fontsize=10)
Plots nodes having node identifiers nodeids
on the plot p
using map information m
. By default the node indices within the are plotted (e.g. 1, 2, 3...), however, setting the parameter start_numbering_from
to nothing will show actual OSM node identifiers. The km
parameter can be used to have a kilometer scale of the map instead of meters.
Returns an object that can be used for further plot updates.