- push @json, {
- type => "Feature",
- geometry => {
- type => "LineString",
- coordinates => [ [ $clon, $clat ], [ $slon, $slat ] ]
- },
- properties => {
- origin => $origin->{name},
- server => $cluster->{name},
- colour => $cluster->{colour}
+ if ($cluster->{lon} && $cluster->{lat})
+ {
+ my $clon = $origin->{lon};
+ my $clat = $origin->{lat};
+ my $slon = $cluster->{lon};
+ my $slat = $cluster->{lat};
+
+ if ($clon > 0 && $slon < 0 && 360 + $slon - $clon < $clon - $slon)
+ {
+ $slon = $slon + 360;
+ }
+ elsif ($slon > 0 && $clon < 0 && 360 + $clon - $slon < $slon - $clon)
+ {
+ $clon = $clon + 360;