You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to color the roads of a OSM according to their edge-betweenness centrality. I used the following approach, which does not work in the end. Is there a smart way to solve my problem?
I start by plugging in my osm file aswell as computing the roads corresponding edge-betweenness.
Then, I bin the classes of m.class of roads depending on their edge-betweenness
Nbin = 20
for (i, val) in enumerate(σ)
bins = range(0, stop=maximum(σ), length=Nbin)
if val < 1e-10
mx.class[i] = 1
else
for (j, b) in enumerate(reverse(bins))
if val >= b
m.class[i] = Nbin-j+1
break
end
end
end
end
Next I set the Layer colors according to some colormap.
cbar = cgrad(:cividis, Nbin, categorical = true, rev = true)
LAYER_EDGEBETWEENNESS = Dict(1 => OpenStreetMapXPlot.Style("0x"*hex(cbar[1]), 1, "-"))
for i in 2:Nbin
push!(LAYER_EDGEBETWEENNESS, i => OpenStreetMapXPlot.Style("0x"*hex(cbar[i]), 1, "-"))
end
Last, I try to plot the map with the new classes and 'roadwayStyle'
This does not work, because plotmap() uses the data of m.roadways instead of m.class. Is there a smart way do this? I do realise that my way is a workaround anyways, but I dont know how to approach it elseway.
Thanks a lot for your help!
The text was updated successfully, but these errors were encountered:
Hi, unfortunately it is hard-coded to the plotmap() function. However it should be fairly easy to prepare a pull request extending coloring functionality (the code of plotmap() is really simple). If you want to propose some extension, I am all for it :)
One more idea. If you are looking for a less-effort solution you could just plot the roads as an overlay on the map. Firstly, plot the map in a standard way and then plot on it! You have an example at OpenStreetMapXPlot.jl home page.
I want to color the roads of a OSM according to their edge-betweenness centrality. I used the following approach, which does not work in the end. Is there a smart way to solve my problem?
I start by plugging in my osm file aswell as computing the roads corresponding edge-betweenness.
Then, I bin the classes of
m.class
of roads depending on their edge-betweennessNext I set the Layer colors according to some colormap.
Last, I try to plot the map with the new classes and 'roadwayStyle'
This does not work, because
plotmap()
uses the data ofm.roadways
instead ofm.class
. Is there a smart way do this? I do realise that my way is a workaround anyways, but I dont know how to approach it elseway.Thanks a lot for your help!
The text was updated successfully, but these errors were encountered: