Country density plot of lines (highways)

I love solution from question (histogram as well as distrubution) https://mathematica.stackexchange.com/questions/31948/show-density-plot-on-us-map#=.

But both cases are a bit more difficult in my case. I have coordinations in csv file where every line contains

LAT_A, LON_A, LAT_B, LON_B, DENSITY.

Sample code:

49.5671;12.34;50.0033;17.9569;10236
48.7635;16.0479;48.9803;17.3013;83
50.0895;13.3265;49.9450;14.7283;9982


I want to plot "highways" from LAT_A, LON_A to LAT_B, LON_B, where DENSITY is density of this line (it is really not real highway). It's easy - just load file as in the noted solutions, but how to plot these lines with densities and obtain density plot? Also any workaround solution will be more than welcome :-)

Thank you very mcuh!

• Please provide sample data. Nov 11, 2014 at 19:12
• I've updated my question. Nov 11, 2014 at 19:27
• What do you mean by the "density of a line"? Please be as precise as possible.
– user484
Nov 11, 2014 at 20:31
• I am sorry Rahul. Each line represent one air route (coordinations tell you where the route starts and where finishes) and density means for how many times was the route used. There are really many routes with different usage. Is it possible to implement solution of this problem into histogram or density plot in the linked question? I am struggling with this problem for a long time... Nov 11, 2014 at 20:49

Guessing/hoping that the following is not too far off from what you have in mind:

lld = {{49.5671, 15.34, 50.0033, 17.9569, 100},
{48.7635, 16.0479, 49.5671, 15.34, 35},
{50.0033, 17.9569, 48.7635, 16.0479, 75}};

vertices = Join @@ (Partition[#, 2] & /@ lld[[All, ;; -2]]);
edges = Property[UndirectedEdge[{#, #2}, {#3, #4}],
EdgeStyle -> Directive[{Hue[.9 #5/Max[Last /@ lld]],
CapForm["Round"], Thickness[ .1 #5/Max[Last /@ lld]]}]] & @@@ lld;
vlabels = Thread[# -> (Placed[Style[#, 16, "Panel", Background -> Transparent],
Above] & /@ #)] & @ vertices;

Graph[edges, VertexLabels -> vlabels, VertexSize -> Small,
ImagePadding -> 60, VertexCoordinates -> vcoords, ImageSize -> 300]


Update: A DirectedGraph with directed edges in both directions:

lld[[All, -1]] =  Rescale[lld[[All, -1]], Through[{Min, Max}[lld[[All, -1]]]], {.3, .9}];

SeedRandom[223];
llda = lld[[All, {3, 4, 1, 2, 5}]];
llda[[All, -1]] = RandomReal[{.2, .7}, 3];
lld2 = Join[lld, llda];
vertices = Join @@ (Partition[#, 2] & /@ lld2[[All, ;; -2]]);
edges = Property[DirectedEdge[{#, #2}, {#3, #4}],
{EdgeStyle -> Directive[{Hue[.9 #5], CapForm["Butt"], Thickness[.1 #5]}],
EdgeShapeFunction ->  GraphElementData["ShortFilledArrow",
"ArrowSize" -> (.3 #5)]}] & @@@ lld2;
vlabels = Thread[# -> (Placed[Style[#, 16, "Panel", Background -> Transparent],
Below] & /@ #)] &@vertices;