From: Tom Hughes Date: Thu, 13 Oct 2011 11:47:38 +0000 (+0100) Subject: Wrap some longitude coordinates to force them across the date line X-Git-Url: https://git.openstreetmap.org/dns.git/commitdiff_plain/9a2522ef11ee644bdf5a2a309aabd022afeb855f Wrap some longitude coordinates to force them across the date line --- 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"); }