|
// data with source and target connections |
|
var data = [ |
|
{ |
|
"TargetPlaceLongitude":7.537148310785445, |
|
"TargetPlaceLatitude":48.05013590883186, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-6.115818, |
|
"TargetPlaceLatitude":34.60144, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":6.972946051369628, |
|
"TargetPlaceLatitude":50.94579677501803, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.016667, |
|
"TargetPlaceLatitude":54.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.859722, |
|
"TargetPlaceLatitude":49.540278, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.557032, |
|
"TargetPlaceLatitude":34.073697, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":9.330391, |
|
"TargetPlaceLatitude":49.539523, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.983333, |
|
"TargetPlaceLatitude":51.733333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.241355718583725, |
|
"TargetPlaceLatitude":49.974235538721146, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.983333, |
|
"TargetPlaceLatitude":51.733333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.859722, |
|
"TargetPlaceLatitude":49.540278, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.557032, |
|
"TargetPlaceLatitude":34.073697, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.066667, |
|
"TargetPlaceLatitude":51.35, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":6.972946051369628, |
|
"TargetPlaceLatitude":50.94579677501803, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.6371623361290796, |
|
"TargetPlaceLatitude":43.22707597466809, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":9.330391, |
|
"TargetPlaceLatitude":49.539523, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.916667, |
|
"TargetPlaceLatitude":53.2, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.5568138715542259, |
|
"TargetPlaceLatitude":47.476690907826885, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.066667, |
|
"TargetPlaceLatitude":51.35, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":3.443291, |
|
"TargetPlaceLatitude":43.280977, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.016667, |
|
"TargetPlaceLatitude":54.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.859722, |
|
"TargetPlaceLatitude":49.540278, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":9.330391, |
|
"TargetPlaceLatitude":49.539523, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.537148310785445, |
|
"TargetPlaceLatitude":48.05013590883186, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.983333, |
|
"TargetPlaceLatitude":51.733333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":6.972946051369628, |
|
"TargetPlaceLatitude":50.94579677501803, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-6.115818, |
|
"TargetPlaceLatitude":34.60144, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.678333, |
|
"TargetPlaceLatitude":51.007222, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.241355718583725, |
|
"TargetPlaceLatitude":49.974235538721146, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.958889, |
|
"TargetPlaceLatitude":51.613333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.75, |
|
"TargetPlaceLatitude":45.5, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":4.942851, |
|
"TargetPlaceLatitude":43.383543, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.557032, |
|
"TargetPlaceLatitude":34.073697, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.533333, |
|
"TargetPlaceLatitude":53.233333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.6371623361290796, |
|
"TargetPlaceLatitude":43.22707597466809, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.916667, |
|
"TargetPlaceLatitude":53.2, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.678333, |
|
"TargetPlaceLatitude":51.007222, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.537148310785445, |
|
"TargetPlaceLatitude":48.05013590883186, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":6.972946051369628, |
|
"TargetPlaceLatitude":50.94579677501803, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.958889, |
|
"TargetPlaceLatitude":51.613333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.75, |
|
"TargetPlaceLatitude":45.5, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.820762299133417, |
|
"TargetPlaceLatitude":49.90610992846929, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-6.115818, |
|
"TargetPlaceLatitude":34.60144, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":4.942851, |
|
"TargetPlaceLatitude":43.383543, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.557032, |
|
"TargetPlaceLatitude":34.073697, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.016667, |
|
"TargetPlaceLatitude":54.966667, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.016667, |
|
"TargetPlaceLatitude":54.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.533333, |
|
"TargetPlaceLatitude":53.233333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.066667, |
|
"TargetPlaceLatitude":51.35, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.5568138715542259, |
|
"TargetPlaceLatitude":47.476690907826885, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.859722, |
|
"TargetPlaceLatitude":49.540278, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.6371623361290796, |
|
"TargetPlaceLatitude":43.22707597466809, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":9.330391, |
|
"TargetPlaceLatitude":49.539523, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.916667, |
|
"TargetPlaceLatitude":53.2, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.241355718583725, |
|
"TargetPlaceLatitude":49.974235538721146, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":3.484632753011144, |
|
"TargetPlaceLatitude":43.308831654101574, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.983333, |
|
"TargetPlaceLatitude":51.733333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.75, |
|
"TargetPlaceLatitude":45.5, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.958889, |
|
"TargetPlaceLatitude":51.613333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":3.484632753011144, |
|
"TargetPlaceLatitude":43.308831654101574, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.5568138715542259, |
|
"TargetPlaceLatitude":47.476690907826885, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":4.942851, |
|
"TargetPlaceLatitude":43.383543, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.5568138715542259, |
|
"TargetPlaceLatitude":47.476690907826885, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.6371623361290796, |
|
"TargetPlaceLatitude":43.22707597466809, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.916667, |
|
"TargetPlaceLatitude":53.2, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.533333, |
|
"TargetPlaceLatitude":53.233333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.066667, |
|
"TargetPlaceLatitude":51.35, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.110187967092899, |
|
"TargetPlaceLatitude":50.70588797011724, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.97683927730332, |
|
"TargetPlaceLatitude":50.085588186218686, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.678333, |
|
"TargetPlaceLatitude":51.007222, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-1.083333, |
|
"TargetPlaceLatitude":53.966667, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.016667, |
|
"TargetPlaceLatitude":54.966667, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.5568138715542259, |
|
"TargetPlaceLatitude":47.476690907826885, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":4.942851, |
|
"TargetPlaceLatitude":43.383543, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.533333, |
|
"TargetPlaceLatitude":53.233333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":-73.935242, |
|
"SourcePlaceLatitude":40.730610 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":8.241355718583725, |
|
"TargetPlaceLatitude":49.974235538721146, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.093145, |
|
"TargetPlaceLatitude":51.514248, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.04043866023253, |
|
"TargetPlaceLatitude":46.8810261270914, |
|
"SourcePlaceLongitude":null, |
|
"SourcePlaceLatitude":null |
|
}, |
|
{ |
|
"TargetPlaceLongitude":5.478970083150136, |
|
"TargetPlaceLatitude":48.3925857410519, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-0.75, |
|
"TargetPlaceLatitude":45.5, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.958889, |
|
"TargetPlaceLatitude":51.613333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":7.537148310785445, |
|
"TargetPlaceLatitude":48.05013590883186, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-2.678333, |
|
"TargetPlaceLatitude":51.007222, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-6.115818, |
|
"TargetPlaceLatitude":34.60144, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":0.9, |
|
"TargetPlaceLatitude":51.883333, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":6.972946051369628, |
|
"TargetPlaceLatitude":50.94579677501803, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
}, |
|
{ |
|
"TargetPlaceLongitude":-5.64613913717677, |
|
"TargetPlaceLatitude":37.63719595406285, |
|
"SourcePlaceLongitude":44.783333, |
|
"SourcePlaceLatitude":41.716667 |
|
} |
|
]; |
|
|
|
|
|
// width scale for connections. Domain will change |
|
// every time the zoom changes and features are |
|
// reclustered |
|
var lineWidthScale = d3.scale.linear().range([1, 35]); |
|
|
|
// connections will be gradients, set here the |
|
// maximum alpha they can reach |
|
var maxOpacityLine = .5; |
|
|
|
// radius range for cluster features |
|
var scale = d3.scale.linear() |
|
.range([10, 75]) |
|
.domain([1, data.length]); |
|
|
|
|
|
// define map |
|
var map = new ol.Map({ |
|
target: 'map', |
|
layers: [ |
|
new ol.layer.Tile({ |
|
source: new ol.source.XYZ({ |
|
url:'http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}' |
|
}) |
|
}) |
|
], |
|
view: new ol.View({ |
|
center: ol.proj.fromLonLat([2.36, 41.19]), |
|
zoom: 4, |
|
minZoom : 1, |
|
maxZoom : 10 |
|
}) |
|
}); |
|
|
|
|
|
|
|
// create feature from data |
|
var features = _(data) |
|
.map(function(place) { |
|
return new ol.Feature({ |
|
geometry : new ol.geom.Point( |
|
ol.proj.fromLonLat([ |
|
place.TargetPlaceLongitude, |
|
place.TargetPlaceLatitude], 'EPSG:3857')), |
|
place : place |
|
}) |
|
}) |
|
.value(); |
|
|
|
|
|
|
|
// assign style to the clustered feature based on data |
|
var getFeatureStyles = function(feature) { |
|
var size = feature.get('features').length, |
|
styleInner = new ol.style.Style({ |
|
image: new ol.style.Circle({ |
|
radius: 1, |
|
fill: new ol.style.Fill({ |
|
color: 'rgba(200, 0, 0, 5)' |
|
}) |
|
}) |
|
}), |
|
styleOuter = new ol.style.Style({ |
|
image: new ol.style.Circle({ |
|
radius: scale(size), |
|
stroke: new ol.style.Stroke({ |
|
color : 'rgba(200, 0, 0, .5)', |
|
width: 1 |
|
}), |
|
fill: new ol.style.Fill({ |
|
color : 'rgba(200, 0, 0, .5)' |
|
}) |
|
}) |
|
}); |
|
|
|
return [styleOuter, styleInner]; |
|
} |
|
|
|
|
|
|
|
var listenSourceChanges = function(layer) { |
|
// the cluster source changes as the map resolution changes, |
|
// so the connections layer does the same. Listen for change |
|
// event and update the connection accordingly, throttling the |
|
// listener to avoid too updates |
|
layer.getSource().on('change', |
|
_.throttle(function() { |
|
createConnectionLayer(layer); |
|
}, |
|
500, |
|
{ 'leading': false, 'trailing': true }) |
|
); |
|
} |
|
|
|
// add layer with clustered features |
|
var layer = new ol.layer.Vector({ |
|
source: new ol.source.Cluster({ |
|
distance: 40, |
|
source: new ol.source.Vector({ features: features }) |
|
}), |
|
style: function(feature) { |
|
return getFeatureStyles(feature) |
|
} |
|
}); |
|
|
|
layer.on('change:source', function() { |
|
listenSourceChanges(layer); |
|
}); |
|
listenSourceChanges(layer); |
|
map.addLayer(layer); |
|
|
|
|
|
map.getView().on('change:resolution', function(event) { |
|
map.removeLayer(connectionLayer); |
|
}); |
|
|
|
|
|
|
|
|
|
// create connections |
|
var connectionLayer; |
|
var createConnectionLayer = function(cluster_layer) { |
|
// for each clustered feature, summarize the |
|
// connections between this point and the |
|
// production places connected with it |
|
var connectionsSummary = |
|
_(cluster_layer.getSource().getFeatures()) |
|
// get array of production places and |
|
// its occurrences for this cluster |
|
.map(function(clusteredFeature) { |
|
return { |
|
cluster: clusteredFeature, |
|
summary : dl.groupby(function(feature) { |
|
return feature.get('place').SourcePlaceLongitude + '@' + feature.get('place').SourcePlaceLatitude; |
|
}) |
|
.execute( |
|
_.filter(clusteredFeature.get('features'), |
|
function(feature) { |
|
return !!feature.get('place').SourcePlaceLatitude && !!feature.get('place').SourcePlaceLongitude; |
|
}) |
|
) |
|
} |
|
}) |
|
// remove clusters with all its binding |
|
// without Production Places |
|
.filter(function(connectionSummary) { |
|
return connectionSummary.summary.length > 0 |
|
}) |
|
.value(); |
|
|
|
if(connectionsSummary.length == 0) |
|
return; |
|
|
|
// update domain for line width and opacity connectors |
|
lineWidthScale.domain([ |
|
d3.min(connectionsSummary, function(connectionSummary) { |
|
return d3.min(connectionSummary.summary, function(summary) { |
|
return summary.values.length; |
|
}) |
|
}), |
|
d3.max(connectionsSummary, function(connectionSummary) { |
|
return d3.max(connectionSummary.summary, function(summary) { |
|
return summary.values.length; |
|
}) |
|
}) |
|
]); |
|
|
|
// generate the Arc features |
|
var arcFeatures = []; |
|
(connectionsSummary).forEach(function(connectionSummary, index) { |
|
// get coordinates for one point of the arc (finding place) |
|
// which is the coords of the cluster feature |
|
var clusterCoord = ol.proj.transform( |
|
connectionSummary.cluster.getGeometry().getCoordinates(), |
|
'EPSG:3857', 'EPSG:4326' |
|
); |
|
connectionSummary.summary.forEach(function(summary) { |
|
// arc has the direction: |
|
// start: findingPlace |
|
// end: production place |
|
|
|
var sourceCoord = summary['_0'].split('@'); |
|
var arcGenerator = new arc.GreatCircle( |
|
{ |
|
x: clusterCoord[0], // lon |
|
y: clusterCoord[1], // lat |
|
}, |
|
{ |
|
x: sourceCoord[0], //lon |
|
y: sourceCoord[1] //lat |
|
}), |
|
arcLine = arcGenerator.Arc(100, { offset: 10} ), |
|
line = new ol.geom.LineString(arcLine.geometries[0].coords); |
|
|
|
line.transform(ol.proj.get('EPSG:4326'), ol.proj.get('EPSG:3857')); |
|
arcFeatures.push( |
|
new ol.Feature({ |
|
geometry : line, |
|
bindings : summary.values |
|
}) |
|
); |
|
}); |
|
}); |
|
|
|
connectionLayer = new ol.layer.Image({ |
|
source: new ol.source.ImageVector({ |
|
source: new ol.source.Vector({ |
|
wrapX: false, |
|
features : arcFeatures |
|
}), |
|
updateWhileAnimating: false, |
|
updateWhileInteracting: false, |
|
style: function(feature) { |
|
var i = 0, |
|
geometry = feature.getGeometry(), |
|
styles = [], |
|
strokeWidthIncrement = (lineWidthScale(feature.get('bindings').length) - lineWidthScale.range()[0]) / (geometry.getCoordinates().length - 1), |
|
opacityIncrement = maxOpacityLine / (geometry.getCoordinates().length - 1); |
|
geometry.forEachSegment(function (start, end) { |
|
styles.push(new ol.style.Style({ |
|
geometry: new ol.geom.LineString([start, end]), |
|
stroke: new ol.style.Stroke({ |
|
lineCap : (i==0)? 'round' : 'butt', |
|
lineJoin : 'miter', |
|
color: 'rgba(200, 0, 0, ' + (maxOpacityLine - (opacityIncrement * i)) + ')', |
|
width: lineWidthScale(feature.get('bindings').length) - (strokeWidthIncrement * i) |
|
}) |
|
})); |
|
i++; |
|
}); |
|
|
|
return styles; |
|
} |
|
}) |
|
}); |
|
|
|
map.addLayer(connectionLayer); |
|
}; |
|
createConnectionLayer(layer); |
|
|
|
console.log("done! ", map); |