From 9a2522ef11ee644bdf5a2a309aabd022afeb855f Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 13 Oct 2011 12:47:38 +0100 Subject: [PATCH] Wrap some longitude coordinates to force them across the date line --- bin/mkgeo | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/bin/mkgeo b/bin/mkgeo index adf8f8b..aa8babb 100755 --- a/bin/mkgeo +++ b/bin/mkgeo @@ -68,17 +68,22 @@ foreach my $country (values %countries) { my @servers = sort { $b->{priority} <=> $a->{priority} || $a->{distance} <=> $b->{distance} } @{$country->{servers}}; my $server = $servers->{$servers[0]->{name}}; + my $clon = $country->{lon}; + my $clat = $country->{lat}; + my $slon = $server->{lon}; + my $slat = $server->{lat}; + + if ($clon > 0 && $slon < 0 && 360 + $slon - $clon < $clon - $slon) + { + $clon = $clon - 360; + } $zonefile->print("C\L$country->{code}\E.${zone}:$servers[0]->{name}.${zone}:600\n"); $kmlwriter->startTag("Placemark"); $kmlwriter->dataElement("name", $country->{name}); $kmlwriter->startTag("LineString"); - $kmlwriter->startTag("coordinates"); - $kmlwriter->characters("$country->{lon},$country->{lat}"); - $kmlwriter->characters(" "); - $kmlwriter->characters("$server->{lon},$server->{lat}"); - $kmlwriter->endTag("coordinates"); + $kmlwriter->dataElement("coordinates", "$clon,$clat $slon,$slat"); $kmlwriter->endTag("LineString"); $kmlwriter->endTag("Placemark"); } -- 2.39.5