-
Notifications
You must be signed in to change notification settings - Fork 1
/
dxcc.pl
1492 lines (1383 loc) · 65.9 KB
/
dxcc.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/perl
# dxcc - determining the DXCC country of a callsign
#
# Copyright (C) 2007 Fabian Kurz, DJ1YFK
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
use strict;
use POSIX;
my $version = '20080225';
my $gui = 0;
my $earthfile = ''; # world map. location will be found later.
my $splash = " Please enter a callsign!";
my $credits = "dxcc $version (c) 2007 Fabian Kurz, DJ1YFK. http://fkurz.net/ham/dxcc/
Determines the ARRL DXCC entity of a ham radio callsign, based on the cty.dat
country file by Jim Reisert, AD1C (http://country-files.com/).
This is free software, and you are welcome to redistribute it
under certain conditions (see COPYING).";
my %prefixes; # hash of arrays main prefix -> (all, prefixes,..)
my %dxcc; # hash of arrays main prefix -> (CQZ, ITUZ, ...)
my $mainprefix;
my @dxcc;
my ($mylat, $mylon) = (50.10, -14.40);
my $args='';
my $lidadditions="^QRP\$|^LGT\$";
my $csadditions="(^P\$)|(^M{1,2}\$)|(^AM\$)";
&read_cty();
if (!$ARGV[0] || ($ARGV[0] =~ /-[^mg]/)) {
print "$credits
Usage: dxcc <callsign>\n\n";
exit;
}
else {
$args = "@ARGV";
if ($args =~ /-g/) {
$gui = 1;
}
if ($args =~ /-m (.+?)\b/) { # Own DXCC for beam headings
($mylat, $mylon) = (&dxcc("\U$1"))[4,5];
$args =~ s/.+\b([A-Z0-9\/]+)/$1/g;
}
}
unless ($gui) {
my @dxcc = &dxcc("\U$args");
my ($bearing, $distance) = &qrbqtf($mylat, $mylon, $dxcc[4], $dxcc[5]);
# print "Callsign: \U$args\n\n";
# print "Main Prefix: $dxcc[7]\n";
# print "Country Name: $dxcc[0]\n";
# print "WAZ Zone: $dxcc[1]\n";
# print "ITU Zone: $dxcc[2]\n";
# print "Continent: $dxcc[3]\n";
# print "Latitude: $dxcc[4]\n";
# print "Longitude: $dxcc[5]\n";
# print "UTC shift: $dxcc[6]\n";
print "$dxcc[3] | <strong>$dxcc[0]</strong> | $dxcc[7] | CQ-$dxcc[1] | ITU-$dxcc[2] | utc $dxcc[6] | QRB $distance\km | Az $bearing";
# if ($mylat || $mylon) {
# print "Bearing: $bearing°\n";
# print "Distance: $distance km\n";
# }
print "\n";
}
###############################################################################
# GUI
# This part is for the GUI only.
###############################################################################
else { # if $gui
our $hastk = 0;
foreach (@INC) {
if (-e $_."/Tk.pm") {
$hastk = 1;
}
}
unless ($hastk) {
die "Tk.pm not found. Exiting.";
}
# This is like 'use Tk', except that use is always done at compile
# time, which is not wanted in this case (when running w/o gui).
require Tk; import Tk;
$earthfile = &search_earth_file;
print "Found earth.gif: $earthfile\n";
my $callsign='';
my $dxcc_result = $splash;
my $mw = MainWindow->new();
$mw->geometry("640x480");
$mw->title("dxcc - a DXCC lookup utility");
my $dot;
my $t_frame = $mw->Frame(-relief=>'groove', -bd=>1)
->pack(-side => 'top', -fill => 'y');
my $m_frame = $mw->Frame(-bd => 2)
->pack(-side => 'top', -fill => 'y');
my $b_frame = $mw->Frame( -bd => 2)
->pack(-side => 'bottom', -fill => 'both');
my $canvas = $t_frame->Canvas(-height => 320, -width=> 640 )->pack( );
my $photo = $t_frame->Photo( -file => $earthfile );
my $earth = $canvas->createImage(320,160, -image=> $photo, -tags => 'item');
# Home-Marker, if $mylon || $mylat set
if ($mylon || $mylat) {
my $homedot = $canvas->createOval((640*(180 - $mylon)/360)-5,(320*(90 -
$mylat)/180)-5, (640*(180 - $mylon)/360)+5,
(320*(90 - $mylat)/180)+5, -fill => 'green');
}
$m_frame->Label(-text => "Callsign: ")->pack(-side => 'left');
my $call_entry = $m_frame->Entry(-textvariable => \$callsign,
-relief => 'sunken', -validate => 'all', -validatecommand =>
\&validate) ->pack(-side =>'right');
$call_entry->focus;
$mw->Label(-textvariable => \$dxcc_result, -justify => 'left',
-font => "courier 12")->pack(-side => 'left');
my $exit_b = $b_frame->Button(-text => "Exit", -command => sub { exit })
->pack(-side=>'right', -expand => 1);
my $clear_b= $b_frame->Button(-text => "Clear", -command =>
sub { $call_entry->delete(0, 'end'); $callsign = ''; })
->pack(-side => 'left', -expand => 1);
my $credits_b = $b_frame->Button(-text => "Credits", -command => \&credits)
->pack(-side => 'left', -expand => 1);
MainLoop();
sub validate {
if ($_[1] =~ /[0-9A-Za-z\/]/) {
@dxcc = &dxcc("\U$_[0]");
my ($bearing, $distance) = &qrbqtf($mylat, $mylon, $dxcc[4], $dxcc[5]);
unless ($dxcc[2]) {
$dxcc_result = $splash;
}
else {
$dxcc[0] .= " ($dxcc[7])";
$dxcc_result = sprintf(
"Country Name: %-20s".
"WAZ Zone: %s\n".
"ITU Zone: %-20s".
"Continent: %s\n".
"Latitude: %-20s".
"Longitude: %s\n".
"UTC shift: %-20s\n", @dxcc[0..6]
);
if ($mylat || $mylon) { # One may be zero :-)
$dxcc_result .= sprintf(
"Distance (km): %-20s".
"Bearing (°): %s\n",
$distance, $bearing
)
}
}
my $lon = 640*(180 - $dxcc[5])/360;
my $lat = 320*(90 - $dxcc[4])/180;
$canvas->delete($dot) if (defined($dot));
$dot = $canvas->createOval($lon-5,$lat-5, $lon+5, $lat+5, -fill =>
'red') if ($dxcc[2]);
return 1;
}
else {
return 0;
}
}
sub credits {
my $creditwindow = MainWindow->new();
$creditwindow->geometry("500x170");
$creditwindow->title("dxcc - Credits");
$creditwindow->Label(-text =>
"$credits\n\nMap: http://earthobservatory.nasa.gov/Newsroom/BlueMarble/",
-justify => 'left')->pack();
my $exit_b = $creditwindow->Button(-text => "Exit", -command =>
sub { $creditwindow->destroy })
->pack(-side=>'right', -expand => 1);
}
}
# End of GUI
###############################################################################
#
# &wpx derives the Prefix following WPX rules from a call. These can be found
# at: http://www.cq-amateur-radio.com/wpxrules.html
# e.g. DJ1YFK/TF3 can be counted as both DJ1 or TF3, but this sub does
# not ask for that, always TF3 (= the attached prefix) is returned. If that is
# not want the OP wanted, it can still be modified manually.
#
###############################################################################
sub wpx {
my ($prefix,$a,$b,$c);
# First check if the call is in the proper format, A/B/C where A and C
# are optional (prefix of guest country and P, MM, AM etc) and B is the
# callsign. Only letters, figures and "/" is accepted, no further check if the
# callsign "makes sense".
# 23.Apr.06: Added another "/X" to the regex, for calls like RV0AL/0/P
# as used by RDA-DXpeditions....
if ($_[0] =~
/^((\d|[A-Z])+\/)?((\d|[A-Z]){3,})(\/(\d|[A-Z])+)?(\/(\d|[A-Z])+)?$/) {
# Now $1 holds A (incl /), $3 holds the callsign B and $5 has C
# We save them to $a, $b and $c respectively to ensure they won't get
# lost in further Regex evaluations.
($a, $b, $c) = ($1, $3, $5);
if ($a) { chop $a }; # Remove the / at the end
if ($c) { $c = substr($c,1,)}; # Remove the / at the beginning
# In some cases when there is no part A but B and C, and C is longer than 2
# letters, it happens that $a and $b get the values that $b and $c should
# have. This often happens with liddish callsign-additions like /QRP and
# /LGT, but also with calls like DJ1YFK/KP5. ~/.yfklog has a line called
# "lidadditions", which has QRP and LGT as defaults. This sorts out half of
# the problem, but not calls like DJ1YFK/KH5. This is tested in a second
# try: $a looks like a call (.\d[A-Z]) and $b doesn't (.\d), they are
# swapped. This still does not properly handle calls like DJ1YFK/KH7K where
# only the OP's experience says that it's DJ1YFK on KH7K.
if (!$c && $a && $b) { # $a and $b exist, no $c
if ($b =~ /$lidadditions/) { # check if $b is a lid-addition
$b = $a; $a = undef; # $a goes to $b, delete lid-add
}
elsif (($a =~ /\d[A-Z]+$/) && ($b =~ /\d$/)) { # check for call in $a
}
}
# *** Added later *** The check didn't make sure that the callsign
# contains a letter. there are letter-only callsigns like RAEM, but not
# figure-only calls.
if ($b =~ /^[0-9]+$/) { # Callsign only consists of numbers. Bad!
return undef; # exit, undef
}
# Depending on these values we have to determine the prefix.
# Following cases are possible:
#
# 1. $a and $c undef --> only callsign, subcases
# 1.1 $b contains a number -> everything from start to number
# 1.2 $b contains no number -> first two letters plus 0
# 2. $a undef, subcases:
# 2.1 $c is only a number -> $a with changed number
# 2.2 $c is /P,/M,/MM,/AM -> 1.
# 2.3 $c is something else and will be interpreted as a Prefix
# 3. $a is defined, will be taken as PFX, regardless of $c
if ((not defined $a) && (not defined $c)) { # Case 1
if ($b =~ /\d/) { # Case 1.1, contains number
$b =~ /(.+\d)[A-Z]*/; # Prefix is all but the last
$prefix = $1; # Letters
}
else { # Case 1.2, no number
$prefix = substr($b,0,2) . "0"; # first two + 0
}
}
elsif ((not defined $a) && (defined $c)) { # Case 2, CALL/X
if ($c =~ /^(\d)$/) { # Case 2.1, number
$b =~ /(.+\d)[A-Z]*/; # regular Prefix in $1
# Here we need to find out how many digits there are in the
# prefix, because for example A45XR/0 is A40. If there are 2
# numbers, the first is not deleted. If course in exotic cases
# like N66A/7 -> N7 this brings the wrong result of N67, but I
# think that's rather irrelevant cos such calls rarely appear
# and if they do, it's very unlikely for them to have a number
# attached. You can still edit it by hand anyway..
if ($1 =~ /^([A-Z]\d)\d$/) { # e.g. A45 $c = 0
$prefix = $1 . $c; # -> A40
}
else { # Otherwise cut all numbers
$1 =~ /(.*[A-Z])\d+/; # Prefix w/o number in $1
$prefix = $1 . $c;} # Add attached number
}
elsif ($c =~ /$csadditions/) {
$b =~ /(.+\d)[A-Z]*/; # Known attachment -> like Case 1.1
$prefix = $1;
}
elsif ($c =~ /^\d\d+$/) { # more than 2 numbers -> ignore
$b =~ /(.+\d)[A-Z]*/; # see above
$prefix = $1;
}
else { # Must be a Prefix!
if ($c =~ /\d$/) { # ends in number -> good prefix
$prefix = $c;
}
else { # Add Zero at the end
$prefix = $c . "0";
}
}
}
elsif (defined $a) { # $a contains the prefix we want
if ($a =~ /\d$/) { # ends in number -> good prefix
$prefix = $a
}
else { # add zero if no number
$prefix = $a . "0";
}
}
# In very rare cases (right now I can only think of KH5K and KH7K and FRxG/T
# etc), the prefix is wrong, for example KH5K/DJ1YFK would be KH5K0. In this
# case, the superfluous part will be cropped. Since this, however, changes the
# DXCC of the prefix, this will NOT happen when invoked from with an
# extra parameter $_[1]; this will happen when invoking it from &dxcc.
if (($prefix =~ /(\w+\d)[A-Z]+\d/) && (not defined $_[1])) {
$prefix = $1;
}
return $prefix;
}
else { return ''; } # no proper callsign received.
} # wpx ends here
##############################################################################
#
# &dxcc determines the DXCC country of a given callsign using the cty.dat file
# provided by K1EA at http://www.k1ea.com/cty/cty.dat .
# An example entry of the file looks like this:
#
# Portugal: 14: 37: EU: 38.70: 9.20: 0.0: CT:
# CQ,CR,CR5A,CR5EBD,CR6EDX,CR7A,CR8A,CR8BWW,CS,CS98,CT,CT98;
#
# The first line contains the name of the country, WAZ, ITU zones, continent,
# latitude, longitude, UTC difference and main Prefix, the second line contains
# possible Prefixes and/or whole callsigns that fit for the country, sometimes
# followed by zones in brackets (WAZ in (), ITU in []).
#
# This sub checks the callsign against this list and the DXCC in which
# the best match (most matching characters) appear. This is needed because for
# example the CTY file specifies only "D" for Germany, "D4" for Cape Verde.
# Also some "unusual" callsigns which appear to be in wrong DXCCs will be
# assigned properly this way, for example Antarctic-Callsigns.
#
# Then the callsign (or what appears to be the part determining the DXCC if
# there is a "/" in the callsign) will be checked against the list of prefixes
# and the best matching one will be taken as DXCC.
#
# The return-value will be an array ("Country Name", "WAZ", "ITU", "Continent",
# "latitude", "longitude", "UTC difference", "DXCC").
#
###############################################################################
sub dxcc {
my $testcall = shift;
my $matchchars=0;
my $matchprefix='';
my $test;
my $zones = ''; # annoying zone exceptions
my $goodzone;
my $letter='';
if ($testcall =~ /(^OH\/)|(\/OH[1-9]?$)/) { # non-Aland prefix!
$testcall = "OH"; # make callsign OH = finland
}
elsif ($testcall =~ /(^3D2R)|(^3D2.+\/R)/) { # seems to be from Rotuma
$testcall = "3D2RR"; # will match with Rotuma
}
elsif ($testcall =~ /^3D2C/) { # seems to be from Conway Reef
$testcall = "3D2CR"; # will match with Conway
}
elsif ($testcall =~ /\w\/\w/) { # check if the callsign has a "/"
$testcall = &wpx($testcall,1)."AA"; # use the wpx prefix instead, which may
# intentionally be wrong, see &wpx!
}
$letter = substr($testcall, 0,1);
foreach $mainprefix (keys %prefixes) {
foreach $test (@{$prefixes{$mainprefix}}) {
my $len = length($test);
if ($letter ne substr($test,0,1)) { # gains 20% speed
next;
}
$zones = '';
if (($len > 5) && ((index($test, '(') > -1) # extra zones
|| (index($test, '[') > -1))) {
$test =~ /^([A-Z0-9\/]+)([\[\(].+)/;
$zones .= $2 if defined $2;
$len = length($1);
}
if ((substr($testcall, 0, $len) eq substr($test,0,$len)) &&
($matchchars <= $len)) {
$matchchars = $len;
$matchprefix = $mainprefix;
$goodzone = $zones;
}
}
}
my @mydxcc; # save typing work
if (defined($dxcc{$matchprefix})) {
@mydxcc = @{$dxcc{$matchprefix}};
}
else {
@mydxcc = qw/Unknown 0 0 0 0 0 0 ?/;
}
# Different zones?
if ($goodzone) {
if ($goodzone =~ /\((\d+)\)/) { # CQ-Zone in ()
$mydxcc[1] = $1;
}
if ($goodzone =~ /\[(\d+)\]/) { # ITU-Zone in []
$mydxcc[2] = $1;
}
}
# cty.dat has special entries for WAE countries which are not separate DXCC
# countries. Those start with a "*", for example *TA1. Those have to be changed
# to the proper DXCC. Since there are opnly a few of them, it is hardcoded in
# here.
if ($mydxcc[7] =~ /^\*/) { # WAE country!
if ($mydxcc[7] eq '*TA1') { $mydxcc[7] = "TA" } # Turkey
if ($mydxcc[7] eq '*4U1V') { $mydxcc[7] = "OE" } # 4U1VIC is in OE..
if ($mydxcc[7] eq '*GM/s') { $mydxcc[7] = "GM" } # Shetlands
if ($mydxcc[7] eq '*IG9') { $mydxcc[7] = "I" } # African Italy
if ($mydxcc[7] eq '*IT9') { $mydxcc[7] = "I" } # Sicily
if ($mydxcc[7] eq '*JW/b') { $mydxcc[7] = "JW" } # Bear Island
}
# CTY.dat uses "/" in some DXCC names, but I prefer to remove them, for example
# VP8/s ==> VP8s etc.
$mydxcc[7] =~ s/\///g;
return @mydxcc;
} # dxcc ends here
sub read_cty {
# Read cty.dat from AD1C, or this program itself (contains cty.dat)
my $self=0;
my $filename;
if (-e "/usr/share/dxcc/cty.dat") {
$filename = "/usr/share/dxcc/cty.dat";
}
elsif (-e "/usr/local/share/dxcc/cty.dat") {
$filename = "/usr/local/share/dxcc/cty.dat";
}
else {
$filename = $0;
$self = 1;
}
open CTY, $filename;
while (my $line = <CTY>) {
# When opening itself, skip all lines before "CTY".
if ($self) {
if ($line =~ /^#CTY/) {
$self = 0
}
next;
}
# In case we're reading this file, remove #s
if (substr($line, 0, 1) eq '#') {
substr($line, 0, 1) = '';
}
if (substr($line, 0, 1) ne ' ') { # New DXCC
$line =~ /\s+([*A-Za-z0-9\/]+):\s+$/;
$mainprefix = $1;
$line =~ s/\s{2,}//g;
@{$dxcc{$mainprefix}} = split(/:/, $line);
}
else { # prefix-line
$line =~ s/\s+//g;
unless (defined($prefixes{$mainprefix}[0])) {
@{$prefixes{$mainprefix}} = split(/,|;/, $line);
}
else {
push(@{$prefixes{$mainprefix}}, split(/,|;/, $line));
}
}
}
close CTY;
} # read_cty
sub search_earth_file {
if (-e 'earth.gif') { # current dir
return 'earth.gif';
}
elsif ($0 =~ /(.+)\/bin\/dxcc$/) {
if (-e $1."/share/dxcc/earth.gif") {
return $1."/share/dxcc/earth.gif"
}
}
if (-e '/usr/local/share/dxcc/earth.gif') {
return '/usr/local/share/dxcc/earth.gif';
}
elsif (-e '/usr/share/dxcc/earth.gif') {
return '/usr/share/dxcc/earth.gif';
}
die "Couldn't find 'earth.gif'. Tried:\n".
"./earth.gif,\n$1/share/dxcc/earth.gif,\n".
"/usr/local/share/dxcc/earth.gif,\n/usr/share/dxcc/earth.gif\n";
}
sub qrbqtf {
my ($mylat, $mylon, $hislat, $hislon) = @_;
my $PI=3.14159265;
my $z =180/$PI;
my $g = acos(sin($mylat/$z)*sin($hislat/$z)+cos($mylat/$z)*cos($hislat/$z)*
cos(($hislon-$mylon)/$z));
my $dist = $g * 6371;
my $dir = 0;
unless ($dist == 0) {
$dir = acos((sin($hislat/$z)-sin($mylat/$z)*cos($g))/
(cos($mylat/$z)*sin($g)))*360/(2*$PI);
}
if (sin(($hislon-$mylon)/$z) < 0) { $dir = 360 - $dir;}
$dir = 360 - $dir;
return (int($dir), int($dist));
}
exit;
#CTY
#Sov Mil Order of Malta: 15: 28: EU: 41.90: -12.40: -1.0: 1A:
# 1A;
#Spratly Is.: 26: 50: AS: 8.80: -111.90: -8.0: 1S:
# 1S,9M0,BV9S,9M2/PG5M,9M4SDX,DU0K,DX0JP,DX0K;
#Monaco: 14: 27: EU: 43.70: -7.40: -1.0: 3A:
# 3A;
#Agalega & St. Brandon: 39: 53: AF: -10.40: -56.60: -4.0: 3B6:
# 3B6,3B7;
#Mauritius: 39: 53: AF: -20.30: -57.50: -4.0: 3B8:
# 3B8;
#Rodriguez I.: 39: 53: AF: -19.70: -63.40: -4.0: 3B9:
# 3B9;
#Equatorial Guinea: 36: 47: AF: 1.80: -9.80: -1.0: 3C:
# 3C;
#Annobon: 36: 52: AF: -1.50: -5.60: 0.0: 3C0:
# 3C0;
#Fiji: 32: 56: OC: -18.10: -178.40: -12.0: 3D2:
# 3D2;
#Conway Reef: 32: 56: OC: -21.40: -174.40: -13.0: 3D2/c:
# 3D2CI,3D2CY;
#Rotuma: 32: 56: OC: -12.30: -177.70: -12.0: 3D2/r:
# 3D2AG/P,3D2RR,3D2RX;
#Swaziland: 38: 57: AF: -26.30: -31.10: -2.0: 3DA:
# 3DA;
#Tunisia: 33: 37: AF: 36.80: -10.20: -1.0: 3V:
# 3V,TS;
#Vietnam: 26: 49: AS: 10.80: -106.70: -7.0: 3W:
# 3W,XV;
#Guinea: 35: 46: AF: 9.50: 13.70: 0.0: 3X:
# 3X;
#Bouvet: 38: 67: AF: -54.50: -3.40: 0.0: 3Y/b:
# 3Y;
#Peter I I.: 12: 72: SA: -68.80: 90.60: 6.0: 3Y/p:
# 3Y0PI,3Y0X,3Y1EE;
#Azerbaijan: 21: 29: AS: 40.40: -49.90: -4.0: 4J:
# 4J,4K;
#Georgia: 21: 29: AS: 41.70: -44.80: -4.0: 4L:
# 4L;
#Montenegro: 15: 28: EU: 42.50: -19.30: -1.0: 4O:
# 4O;
#Sri Lanka: 22: 41: AS: 7.00: -79.90: -5.5: 4S:
# 4P,4Q,4R,4S;
#ITU HQ Geneva: 14: 28: EU: 46.20: -6.20: -1.0: 4U1I:
# 4U1ITU,4U0ITU,4U1WRC,4U2ITU,4U3ITU,4U4ITU,4U5ITU,4U6ITU,4U7ITU,4U8ITU,
# 4U9ITU;
#United Nations HQ: 05: 08: NA: 40.80: 74.00: 5.0: 4U1U:
# 4U0UN,4U1UN,4U2UN,4U3UN,4U4UN,4U50SPACE,4U5UN,4U6UN;
#Vienna Intl Ctr: 15: 28: EU: 48.20: -16.30: -1.0: *4U1V:
# 4U1VIC;
#Timor-Leste: 28: 54: OC: -8.60: -125.50: -8.0: 4W:
# 4W;
#Israel: 20: 39: AS: 31.80: -35.20: -2.0: 4X:
# 4X,4Z;
#Libya: 34: 38: AF: 32.50: -12.50: -2.0: 5A:
# 5A;
#Cyprus: 20: 39: AS: 35.20: -33.40: -2.0: 5B:
# 5B,C4,EURO,H2,P3;
#Tanzania: 37: 53: AF: -7.00: -39.50: -3.0: 5H:
# 5H,5I;
#Nigeria: 35: 46: AF: 6.50: -3.40: -1.0: 5N:
# 5N,5O;
#Madagascar: 39: 53: AF: -18.90: -47.50: -3.0: 5R:
# 5R,5S,6X;
#Mauritania: 35: 46: AF: 18.10: 16.00: 0.0: 5T:
# 5T;
#Niger: 35: 46: AF: 13.50: -2.00: -1.0: 5U:
# 5U;
#Togo: 35: 46: AF: 6.20: -1.40: 0.0: 5V:
# 5V;
#Samoa: 32: 62: OC: -13.50: 171.80: 11.0: 5W:
# 5W;
#Uganda: 37: 48: AF: 0.30: -32.50: -3.0: 5X:
# 5X;
#Kenya: 37: 48: AF: -1.30: -37.50: -3.0: 5Z:
# 5Y,5Z;
#Senegal: 35: 46: AF: 14.70: 17.50: 0.0: 6W:
# 6V,6W;
#Jamaica: 08: 11: NA: 18.00: 76.80: 5.0: 6Y:
# 6Y;
#Yemen: 21: 39: AS: 12.80: -45.00: -3.0: 7O:
# 7O;
#Lesotho: 38: 57: AF: -29.30: -27.50: -2.0: 7P:
# 7P;
#Malawi: 37: 53: AF: -14.90: -34.40: -2.0: 7Q:
# 7Q;
#Algeria: 33: 37: AF: 36.70: -3.00: -1.0: 7X:
# 7R,7T,7U,7V,7W,7X,7Y;
#Barbados: 08: 11: NA: 13.10: 59.60: 4.0: 8P:
# 8P;
#Maldives: 22: 41: AS: 4.40: -73.40: -5.0: 8Q:
# 8Q;
#Guyana: 09: 12: SA: 6.80: 58.20: 4.0: 8R:
# 8R;
#Croatia: 15: 28: EU: 45.50: -15.60: -1.0: 9A:
# 9A;
#Ghana: 35: 46: AF: 5.50: 0.20: 0.0: 9G:
# 9G;
#Malta: 15: 28: EU: 36.00: -14.40: -1.0: 9H:
# 9H;
#Zambia: 36: 53: AF: -15.40: -28.30: -2.0: 9J:
# 9I,9J;
#Kuwait: 21: 39: AS: 29.50: -47.80: -3.0: 9K:
# 9K;
#Sierra Leone: 35: 46: AF: 8.50: 13.20: 0.0: 9L:
# 9L;
#West Malaysia: 28: 54: AS: 3.20: -101.60: -7.5: 9M2:
# 9M2,9M4,9M50,9W2,9W4;
#East Malaysia: 28: 54: OC: 5.80: -118.10: -7.5: 9M6:
# 9M6,9M8,9W6,9W8,9M2/PG5M/6,9M50MS;
#Nepal: 22: 42: AS: 27.70: -85.30: -5.75: 9N:
# 9N;
#Rep. of Congo: 36: 52: AF: -4.30: -15.30: -1.0: 9Q:
# 9O,9P,9Q,9R,9S,9T;
#Burundi: 36: 52: AF: -3.30: -29.30: -2.0: 9U:
# 9U;
#Singapore: 28: 54: AS: 1.30: -103.80: -8.0: 9V:
# 9V,S6;
#Rwanda: 36: 52: AF: -2.00: -30.10: -2.0: 9X:
# 9X;
#Trinidad & Tobago: 09: 11: SA: 10.50: 61.30: 4.0: 9Y:
# 9Y,9Z;
#Botswana: 38: 57: AF: -24.80: -25.90: -2.0: A2:
# 8O,A2;
#Tonga: 32: 62: OC: -21.10: 175.20: -13.0: A3:
# A3;
#Oman: 21: 39: AS: 23.60: -58.60: -4.0: A4:
# A4;
#Bhutan: 22: 41: AS: 27.30: -89.40: -6.5: A5:
# A5;
#United Arab Emirates: 21: 39: AS: 24.50: -54.20: -4.0: A6:
# A6;
#Qatar: 21: 39: AS: 25.30: -51.50: -3.0: A7:
# A7;
#Bahrain: 21: 39: AS: 26.20: -50.60: -3.0: A9:
# A9;
#Pakistan: 21: 41: AS: 24.90: -67.10: -5.0: AP:
# 6P,6Q,6R,6S,AP,AQ,AR,AS;
#Scarborough Reef: 27: 50: AS: 15.10: -117.50: -8.0: BS7:
# BS7;
#Taiwan: 24: 44: AS: 25.10: -121.50: -8.0: BV:
# BM,BN,BO,BP,BQ,BU,BV,BW,BX;
#Pratas Island: 24: 44: AS: 20.40: -116.40: -8.0: BV9P:
# BM9P,BN9P,BO9P,BP9P,BQ9P,BU9P,BV9P,BW9P,BX9P;
#China: 24: 44: AS: 40.00: -116.40: -8.0: BY:
# 3H,3I,3J,3K,3L,3M,3N,3O,3P,3Q,3R,3S,3T,3U,B1,B2,B3,B3G(23)[33],B3H(23)[33],
# B3I(23)[33],B3J(23)[33],B3K(23)[33],B3L(23)[33],B4,B5,B6,B7,B8,B9,B9M(24)[33],
# B9N(24)[33],B9O(24)[33],B9P(24)[33],B9Q(24)[33],B9R(24)[33],B9S(24)[33],BA,
# BA3G(23)[33],BA3H(23)[33],BA3I(23)[33],BA3J(23)[33],BA3K(23)[33],
# BA3L(23)[33],BA9M(24)[33],BA9N(24)[33],BA9O(24)[33],BA9P(24)[33],BA9Q(24)[33],
# BA9R(24)[33],BA9S(24)[33],BD,BD3G(23)[33],BD3H(23)[33],BD3I(23)[33],
# BD3J(23)[33],BD3K(23)[33],BD3L(23)[33],BD9M(24)[33],BD9N(24)[33],
# BD9O(24)[33],BD9P(24)[33],BD9Q(24)[33],BD9R(24)[33],BD9S(24)[33],BG,
# BG3G(23)[33],BG3H(23)[33],BG3I(23)[33],BG3J(23)[33],BG3K(23)[33],
# BG3L(23)[33],BG9M(24)[33],BG9N(24)[33],BG9O(24)[33],BG9P(24)[33],BG9Q(24)[33],
# BG9R(24)[33],BG9S(24)[33],BH,BH3G(23)[33],BH3H(23)[33],BH3I(23)[33],
# BH3J(23)[33],BH3K(23)[33],BH3L(23)[33],BH9M(24)[33],BH9N(24)[33],
# BH9O(24)[33],BH9P(24)[33],BH9Q(24)[33],BH9R(24)[33],BH9S(24)[33],BI,BL,
# BL3G(23)[33],BL3H(23)[33],BL3I(23)[33],BL3J(23)[33],BL3K(23)[33],
# BL3L(23)[33],BL9M(24)[33],BL9N(24)[33],BL9O(24)[33],BL9P(24)[33],BL9Q(24)[33],
# BL9R(24)[33],BL9S(24)[33],BT,BT3G(23)[33],BT3H(23)[33],BT3I(23)[33],
# BT3J(23)[33],BT3K(23)[33],BT3L(23)[33],BT9M(24)[33],BT9N(24)[33],
# BT9O(24)[33],BT9P(24)[33],BT9Q(24)[33],BT9R(24)[33],BT9S(24)[33],BY,
# BY3G(23)[33],BY3H(23)[33],BY3I(23)[33],BY3J(23)[33],BY3K(23)[33],
# BY3L(23)[33],BY9M(24)[33],BY9N(24)[33],BY9O(24)[33],BY9P(24)[33],BY9Q(24)[33],
# BY9R(24)[33],BY9S(24)[33],BZ,BZ3G(23)[33],BZ3H(23)[33],BZ3I(23)[33],
# BZ3J(23)[33],BZ3K(23)[33],BZ3L(23)[33],BZ9M(24)[33],BZ9N(24)[33],
# BZ9O(24)[33],BZ9P(24)[33],BZ9Q(24)[33],BZ9R(24)[33],BZ9S(24)[33],XS;
#Nauru: 31: 65: OC: -0.50: -166.90: -11.5: C2:
# C2;
#Andorra: 14: 27: EU: 42.50: -1.50: -1.0: C3:
# C3;
#Gambia: 35: 46: AF: 13.50: 16.70: 0.0: C5:
# C5;
#Bahamas: 08: 11: NA: 25.10: 77.40: 5.0: C6:
# C6;
#Mozambique: 37: 53: AF: -26.00: -32.60: -2.0: C9:
# C8,C9;
#Chile: 12: 14: SA: -33.50: 70.80: 4.0: CE:
# 3G,CA,CB,CC,CD,CE,XQ,XR;
#San Felix I.: 12: 14: SA: -26.30: 80.10: 6.0: CE0X:
# 3G0X,CA0X,CB0X,CC0X,CD0X,CE0X,XQ0X,XR0X;
#Easter Island: 12: 63: SA: -27.10: 109.40: 6.0: CE0Y:
# 3G0,CA0,CB0,CC0,CD0,CE0,XQ0,XR0;
#Juan Fernandez Is.: 12: 14: SA: -33.60: 78.80: 4.0: CE0Z:
# 3G0Z,CA0Z,CB0Z,CC0Z,CD0Z,CE0I,CE0Z,XQ0Z,XR0Z;
#Antarctica: 13: 74: SA: -65.00: 64.00: -4.0: CE9:
# ANT,AX0,FT0Y(30)[70],FT2Y(30)[70],FT4Y(30)[70],FT5Y(30)[70],FT8Y(30)[70],
# LU1Z[73],R1AN,VH0(39)[69],VI0(39)[69],VJ0(39)[69],VK0(39)[69],VL0(39)[69],
# VM0(39)[69],VN0(39)[69],VZ0(39)[69],ZL0(30)[71],ZL5(30)[71],ZM5(30)[71],
# ZS7(38)[67],8J1RF(39)[67],8J1RL(39)[67],DP0GVN(38)[67],KC4/K2ARB(30)[71],
# KC4AAA(39),KC4AAC[73],KC4USB(12)[72],KC4USV(30)[71],LU4ZS[73],OJ1ABOA(38),
# VP8DJB[73],VP8DKF(30)[71],VP8PJ[73],VP8ROT[73];
#Cuba: 08: 11: NA: 23.10: 82.40: 5.0: CM:
# CL,CM,CO,T4;
#Morocco: 33: 37: AF: 33.60: 7.50: 0.0: CN:
# 5C,5D,5E,5F,5G,CN;
#Bolivia: 10: 12: SA: -16.50: 68.40: 4.0: CP:
# CP;
#Portugal: 14: 37: EU: 38.70: 9.20: 0.0: CT:
# CQ,CR,CS,CT;
#Madeira Is.: 33: 36: AF: 32.60: 16.90: 0.0: CT3:
# CQ3,CQ9,CR3,CR9,CS3,CS9,CT3,CT9,XX;
#Azores: 14: 36: EU: 37.70: 25.70: 1.0: CU:
# CU;
#Uruguay: 13: 14: SA: -34.90: 56.20: 3.0: CX:
# CV,CW,CX;
#Sable I.: 05: 09: NA: 43.80: 60.00: 4.0: CY0:
# CY0;
#St. Paul I.: 05: 09: NA: 47.20: 60.10: 4.0: CY9:
# CY9;
#Angola: 36: 52: AF: -8.80: -13.20: -1.0: D2:
# D2,D3;
#Cape Verde: 35: 46: AF: 14.90: 23.50: 1.0: D4:
# D4;
#Comoros: 39: 53: AF: -11.80: -43.70: -3.0: D6:
# D6;
#Germany: 14: 28: EU: 51.00: -10.00: -1.0: DL:
# DA,DB,DC,DD,DE,DF,DG,DH,DI,DJ,DK,DL,DM,DN,DO,DP,DQ,DR;
#Philippines: 27: 50: OC: 14.60: -121.00: -8.0: DU:
# 4D,4E,4F,4G,4H,4I,DU,DV,DW,DX,DY,DZ;
#Eritrea: 37: 48: AF: 15.30: -38.90: -3.0: E3:
# E3;
#Palestine: 20: 39: AS: 31.40: -35.10: -2.0: E4:
# E4;
#North Cook Is.: 32: 62: OC: -10.40: 161.00: 10.0: E5/n:
# E51WL;
#South Cook Is.: 32: 62: OC: -21.20: 159.80: 10.0: E5/s:
# E5;
#Bosnia-Herzegovina: 15: 28: EU: 43.50: -18.30: -1.0: E7:
# E7,T9;
#Spain: 14: 37: EU: 40.40: 3.70: -1.0: EA:
# AM,AN,AO,EA,EB,EC,ED,EE,EF,EG,EH;
#Balearic Is.: 14: 37: EU: 39.50: -2.60: -1.0: EA6:
# AM6,AN6,AO6,EA6,EB6,EC6,ED6,EE6,EF6,EG6,EH6,ED5ON/6;
#Canary Is.: 33: 36: AF: 28.40: 15.30: 0.0: EA8:
# AM8,AN8,AO8,EA8,EB8,EC8,ED8,EE8,EF8,EG8,EH8;
#Ceuta and Melilla: 33: 37: AF: 35.60: 3.00: -1.0: EA9:
# AM9,AN9,AO9,EA9,EB9,EC9,ED9,EE9,EF9,EG9,EH9;
#Ireland: 14: 27: EU: 53.30: 6.30: 0.0: EI:
# EI,EJ;
#Armenia: 21: 29: AS: 40.30: -44.50: -4.0: EK:
# EK;
#Liberia: 35: 46: AF: 6.30: 10.80: 0.0: EL:
# 5L,5M,6Z,A8,D5,EL;
#Iran: 21: 40: AS: 35.80: -51.80: -3.5: EP:
# 9B,9C,9D,EP,EQ;
#Moldova: 16: 29: EU: 47.00: -28.80: -2.0: ER:
# ER;
#Estonia: 15: 29: EU: 59.40: -24.80: -2.0: ES:
# ES;
#Ethiopia: 37: 48: AF: 9.00: -38.70: -3.0: ET:
# 9E,9F,ET;
#Belarus: 16: 29: EU: 53.90: -27.60: -2.0: EU:
# EU,EV,EW;
#Kyrgyzstan: 17: 31: AS: 42.90: -74.60: -6.0: EX:
# EX;
#Tajikistan: 17: 30: AS: 39.70: -66.80: -5.0: EY:
# EY;
#Turkmenistan: 17: 30: AS: 38.00: -58.40: -5.0: EZ:
# EZ;
#France: 14: 27: EU: 48.80: -2.30: -1.0: F:
# F,HW,HX,HY,TH,TM,TP,TQ,TV,TW;
#Guadeloupe: 08: 11: NA: 16.00: 61.70: 4.0: FG:
# FG,TO1T,TO1USB,TO2ANT,TO2FG,TO2OOO,TO4T,TO5BG,TO5C,TO5G,TO5GI,TO5ROM,TO5S,
# TO6T,TO7ACR,TO7AES,TO7DSR,TO7GAS,TO7T,TO8CW,TO8RR,TO9T;
#Mayotte: 39: 53: AF: -13.00: -45.30: -3.0: FH:
# FH,TO8MZ,TX0P,TX5M,TX5NK,TX5T,TX6A;
#Saint Barthelemy: 08: 11: NA: 17.90: 62.90: 4.0: FJ:
# FJ,TO5FJ;
#New Caledonia: 32: 56: OC: -22.30: -166.50: -11.0: FK:
# FK,TX8,TX1A,TX3SAM,TX5CW;
#Chesterfield Is.: 30: 56: OC: -19.90: -158.30: -11.0: FK/c:
# TX0AT,TX0C,TX0DX,TX9;
#Martinique: 08: 11: NA: 14.60: 61.00: 4.0: FM:
# FM,TO0O,TO0P,TO1A,TO1YR,TO2DX,TO3M,TO3T,TO3W,TO4A,TO5A,TO5AA,TO5J,TO5MM,
# TO5T,TO5X,TO6M,TO7HAM,TO7X,TO8B,TO9A,TX4B;
#French Polynesia: 32: 63: OC: -17.60: 149.50: 10.0: FO:
# FO;
#Austral Is.: 32: 63: OC: -22.50: 152.00: 10.0: FO/a:
# FO/DL1AWI,FO/DL5XU,FO/DL9AWI;
#Clipperton I.: 07: 10: NA: 10.30: 109.20: 7.0: FO/c:
# FO0/F8UFT,FO0AAA,FO0CI,TX5C;
#Marquesas Is.: 31: 63: OC: -9.00: 139.50: 10.0: FO/m:
# FO/HA9G,FO/OH1RX;
#St. Pierre & Miquelon: 05: 09: NA: 46.70: 56.00: 3.0: FP:
# FP;
#Reunion: 39: 53: AF: -21.10: -55.60: -4.0: FR:
# FR;
#Glorioso: 39: 53: AF: -11.50: -47.30: -4.0: FR/g:
# TO4G;
#Juan de Nova & Europa: 39: 53: AF: -19.60: -41.60: -3.0: FR/j:
# TO4E;
#Tromelin: 39: 53: AF: -15.90: -54.40: -4.0: FR/t:
# FR5ZU/T;
#French St. Martin: 08: 11: NA: 18.10: 63.10: 4.0: FS:
# FS,TO5D;
#Crozet: 39: 68: AF: -46.00: -52.00: -4.0: FT5W:
# FT0W,FT2W,FT4W,FT5W,FT8W;
#Kerguelen: 39: 68: AF: -49.30: -69.20: -5.0: FT5X:
# FT0X,FT2X,FT4X,FT5X,FT8X;
#Amsterdam & St. Paul: 39: 68: AF: -37.70: -77.60: -5.0: FT5Z:
# FT0Z,FT2Z,FT4Z,FT5Z,FT8Z;
#Wallis & Futuna Is.: 32: 62: OC: -13.30: 176.30: -12.0: FW:
# FW;
#French Guiana: 09: 12: SA: 4.90: 52.30: 3.0: FY:
# FY,TO7C,TO7IR,TO7R,TX0A;
#England: 14: 27: EU: 51.50: 0.10: 0.0: G:
# 2E,G,M;
#Isle of Man: 14: 27: EU: 54.30: 4.50: 0.0: GD:
# 2D,2T,GD,GT,MD,MT,GB0MST,GB0WCY,GB100MER,GB100TT,GB125SR,GB2IOM,GB2MAD,
# GB2WB,GB3GD,GB4IOM,GB4MNH,GB4WXM/P,GB50UN,GB5MOB,GB6SPC;
#Northern Ireland: 14: 27: EU: 54.60: 5.90: 0.0: GI:
# 2I,2N,GI,GN,MI,MN,GB0BTC,GB0BVC,GB0CI,GB0CSC,GB0DDF,GB0GPF,GB0MFD,GB0PSM,
# GB0REL,GB0SHC,GB0SIC,GB0SPD,GB0TCH,GB0WOA,GB1SPD,GB2IL,GB2LL,GB2MGY,
# GB2MRI,GB2NIC,GB2NTU,GB2TCA,GB3MNI,GB4CSC,GB4ES,GB4SPD,GB50AAD,GB5BIG,
# GB5BL,GB5SPD,GB90SOM;
#Jersey: 14: 27: EU: 49.30: 2.20: 0.0: GJ:
# 2H,2J,GH,GJ,MH,MJ,GB0CLR,GB0GUD,GB0JSA,GB0SHL,GB2BYL,GB2JSA,GB4BHF,
# GB50JSA;
#Scotland: 14: 27: EU: 55.80: 4.30: 0.0: GM:
# 2A,2M,2S,GM,GS,MM,MS,GB0AC,GB0BNC,GB0BWT,GB0DGL,GB0FFS,GB0FLA,GB0GDS,
# GB0GEI,GB0GHD,GB0GKR,GB0GNE,GB0HHW,GB0KGS,GB0KTC,GB0LCS,GB0MLM,GB0MOL,
# GB0NHL,GB0OS,GB0OYT,GB0PPE,GB0QWM,GB0RBS,GB0SHP,GB0SK,GB0SKY,GB0SS,GB0SSF,
# GB100MAS,GB125BRC,GB150NRL,GB1EPC,GB1FVT,GB2AGG,GB2AST,GB2AYR,GB2CHG,
# GB2DHS,GB2FBM,GB2FIO,GB2FSM,GB2GNL,GB2GTM,GB2HI,GB2HRH,GB2HST,GB2HSW,
# GB2IAS,GB2IGB,GB2IGS,GB2IOC,GB2IOG,GB2IOT,GB2JUNO,GB2KDS,GB2KHL,GB2LAY,
# GB2LBN,GB2LCL,GB2LCP,GB2LGB,GB2LHI,GB2LMG,GB2LNM,GB2LO,GB2LP,GB2LS,GB2LSS,
# GB2LT,GB2LTN,GB2MAS,GB2MOD,GB2MOF,GB2MSL,GB2MUL,GB2NAG,GB2NBC,GB2NCL,
# GB2NEF,GB2NL,GB2NTS,GB2OWM,GB2OYC,GB2PBF,GB2PS,GB2RB,GB2RRL,GB2SKG,GB2SLH,
# GB2SPD,GB2SSF,GB2STB,GB2TDS,GB2TI,GB2WBB,GB3GM,GB400CA,GB4AAS,GB4CGW,
# GB4DAS,GB4GM,GB4LNM,GB4NFE,GB4PMS,GB4RAF,GB4SLH,GB4TSR,GB4ZBS,GB50ATC,
# GB50JS,GB50SWL,GB5AST,GB5BBS,GB5CO,GB5FHC,GB5OL,GB5RO,GB5SI,GB5TI,GB60BBC,
# GB60CRB,GB60NTS,GB6MI,GB6SA,GB6SM,GB6TAA,GB6WW,GB700BSB,GB75GD,GB75SCP,
# GB75STT,GB8AYR,GB8CA,GB8CF,GB8CI,GB8CM,GB8CN,GB8CO,GB8CSL,GB8CY,GB8FF,
# GB8OO,GB8RU,GB93AM;
#Shetland: 14: 27: EU: 60.40: 1.50: 0.0: *GM/s:
# GZ,MZ,2M0ZET,GB2ELH,GM0AVR,GM0CXQ,GM0CYJ,GM0DJI,GM0EKM,GM0ILB,GM0ULK,
# GM1ZNR,GM3KLA,GM3WHT,GM3ZET,GM3ZNM,GM4GPP,GM4GQM,GM4IPK,GM4LBE,GM4LER,
# GM4SLV,GM4SSA,GM4SWU,GM4WXQ,GM4ZHL,GM7AFE,GM7GWW,GM8LNH,GM8MMA,GM8YEC,
# MM0LSM,MM0XAU,MM0ZAL,MM1FJM,MM3VQO,MM5PSL,MS0ZCG;
#Guernsey: 14: 27: EU: 49.50: 2.70: 0.0: GU:
# 2P,2U,GP,GU,MP,MU,GB0GUC,GB0JAG,GB0ON,GB0U,GB2ECG,GB2GU,GB50LIB;
#Wales: 14: 27: EU: 51.50: 3.20: 0.0: GW:
# 2C,2W,2X,2Y,GC,GW,MC,MW,GB0CCE,GB0CLC,GB0CVA,GB0GCR,GB0GIW,GB0GLV,GB0HEL,
# GB0HMT,GB0ML,GB0MPA,GB0MWL,GB0NEW,GB0PSG,GB0RPO,GB0RSC,GB0SDD,GB0SH,
# GB0SOA,GB0SPS,GB0SRH,GB0TD,GB0TTT,GB0WRC,GB100BD,GB100FI,GB100LP,GB1CCC,
# GB1LSG,GB1SL,GB1SSL,GB1TDS,GB2000SET,GB200A,GB200HNT,GB2ANG,GB2CPC,GB2GGM,
# GB2GLS,GB2GOL,GB2GSG,GB2GSS,GB2HDG,GB2IMD,GB2LNP,GB2LSA,GB2MIL,GB2MLM,
# GB2MOP,GB2RFS,GB2RSC,GB2RTB,GB2SDD,GB2SIP,GB2TD,GB2TTA,GB2VK,GB2WDS,
# GB2WFF,GB2WHO,GB2WSF,GB4BPL,GB4CI,GB4DPS,GB4HMD,GB4HMM,GB4LSG,GB4MD,
# GB4MDI,GB4NDG,GB4SA,GB4SMM,GB4SNF,GB4XXX,GB5BS/J,GB5FI,GB5SIP,GB60VLY,
# GB6AR,GB6GW,GB6OQA,GB750CC,GB8OQE;
#Solomon Islands: 28: 51: OC: -9.40: -160.00: -11.0: H4:
# H4;
#Temotu: 32: 51: OC: -10.70: -165.80: -11.0: H40:
# H40;
#Hungary: 15: 28: EU: 47.50: -19.10: -1.0: HA:
# HA,HG;
#Switzerland: 14: 28: EU: 47.00: -7.50: -1.0: HB:
# HB,HE;
#Liechtenstein: 14: 28: EU: 47.20: -9.60: -1.0: HB0:
# HB0,HE0;
#Ecuador: 10: 12: SA: -0.20: 78.00: 5.0: HC:
# HC,HD;
#Galapagos Is.: 10: 12: SA: -0.50: 90.50: 6.0: HC8:
# HC8,HD8;
#Haiti: 08: 11: NA: 18.50: 72.30: 5.0: HH:
# 4V,HH;
#Dominican Republic: 08: 11: NA: 18.50: 70.00: 4.0: HI:
# HI;
#Colombia: 09: 12: SA: 4.60: 74.10: 5.0: HK:
# 5J,5K,HJ,HK;
#San Andres/Providencia: 07: 11: NA: 12.50: 81.70: 5.0: HK0/a:
# 5J0,5K0,HJ0,HK0;
#Malpelo I.: 09: 12: SA: 4.00: 81.10: 5.0: HK0/m:
# 5J0M,5K0M,HJ0M,HK0M,HK0TU;
#South Korea: 25: 44: AS: 37.50: -127.00: -9.0: HL:
# 6K,6L,6M,6N,D7,D8,D9,DS,DT,HL;
#North Korea: 25: 44: AS: 39.00: -126.00: -9.0: HM:
# HM,P5,P6,P7,P8,P9;
#Panama: 07: 11: NA: 9.00: 79.50: 5.0: HP:
# 3E,3F,H3,H8,H9,HO,HP;
#Honduras: 07: 11: NA: 14.10: 87.20: 6.0: HR:
# HQ,HR;
#Thailand: 26: 49: AS: 13.80: -100.50: -7.0: HS:
# E2,HS;
#Vatican City: 15: 28: EU: 41.90: -12.50: -1.0: HV:
# HV;
#Saudi Arabia: 21: 39: AS: 26.30: -50.00: -3.0: HZ:
# 7Z,8Z,HZ;
#Italy: 15: 28: EU: 41.90: -12.50: -1.0: I:
# I;
#Italy (Africa): 33: 37: AF: 35.40: -12.50: -1.0: *IG9:
# IG9,IH9;
#Sardinia: 15: 28: EU: 39.20: -9.10: -1.0: IS:
# IM0,IS,IW0U,IW0V,IW0W,IW0X,IW0Y,IW0Z,IQ0AG,IQ0AH,IQ0AI,IQ0AK,IQ0AL,IQ0AM,
# IQ0EH,IQ0HO,IQ0QP,IQ0SS;
#Sicily: 15: 28: EU: 37.50: -14.00: -1.0: *IT9:
# IB9,ID9,IE9,IF9,II9,IJ9,IO9,IQ9,IR9,IT,IU9,IW9,IZ9;
#Djibouti: 37: 48: AF: 11.60: -43.20: -3.0: J2:
# J2;
#Grenada: 08: 11: NA: 12.00: 61.80: 4.0: J3:
# J3;
#Guinea-Bissau: 35: 46: AF: 11.90: 15.60: 0.0: J5:
# J5;
#St. Lucia: 08: 11: NA: 13.90: 61.00: 4.0: J6: