pszufe / OpenStreetMapX.jl

OpenStreetMap (*.osm) support for Julia 1.0 and up
MIT License
118 stars 24 forks source link

Polylines in plot_map from samples #41

Open mcamachom opened 3 years ago

mcamachom commented 3 years ago

The function plot_map included in samples, does not take into account roadways defined with polylines, so, tile streets do not match the plotted ones. I have substituted this part:

for e in edges(m,g)
info = "Edge from: $(e.src) to $(e.dst)<br>[information from the <pre>.e</pre> and <pre>.w</pre> fields] "
flm.PolyLine(  (latlon(m,e.src), latlon(m,e.dst)), color="brown", weight=4, opacity=1).add_to(m_plot)
end

by this:

for e in m.roadways
    puntos=[]
    for i in 1:size(e.nodes,1)
        lla=LLA(m.nodes[e.nodes[i]],m.bounds)
        append!(puntos, [(lla.lat, lla.lon)])
    end
info = "Edge $(e)\n<br>[information from the <pre>.e</pre> and <pre>.w</pre> fields] "
    flm.PolyLine(  puntos, color="blue", popup=info, weight=4, opacity=1).add_to(m_plot)
end

and now it seems to work.