]> git.openstreetmap.org Git - dns.git/blobdiff - bin/mkgeo
Fix ramoth ip address
[dns.git] / bin / mkgeo
index adf8f8b2526be1069226769756a02ab4aaae311c..aa8babb243fd7fccd25b16e00565d2ed8070c079 100755 (executable)
--- 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");
 }