aprs.fi Maidenhead Grid Overlay

Since some roving through various grids is also a sport on QO-100 I keep track of some stations using APRS. Some people use robust packet APRS via QO-100 while others do 2m VHF APRS. However all position data is available on aprs.fi. The only thing missing here IMHO is a small overlay that shows Maidenhead grids. There is a small text box showing the grid under the cursor but that is not really helpful here.

After a bit of research and asking in the aprs.fi group I found [1] which basically allows for adding a .kml file which contents are then shown on the aprs.fi map. KI7UNJ was so kind as to send me his .kml file. But apparently it seems that the file with all Maidenhead grids is simply too large to be displayed.

So then was the time to generate some (perl) script to generate an xml file containing all Maidenhead grid squares. This is the quick and dirty solution I came up with after some time:

#!/usr/bin/perl -w
use open qw( :std :encoding(UTF-8) );
my $filename = "maidenhead_gridquares.kml";
open(FH, '>', $filename) or die $!;
print FH "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
print FH "<kml xmlns=\"http://www.opengis.net/kml/2.2\" xmlns:gx=\"http://www.google.com/kml/ext/2.2\" xmlns:kml=\"http://www.opengis.net/kml/2.2\" xmlns:atom=\"http://www.w3.org/2005/Atom\">\n";
print FH "<Folder>\n";
print FH "   <name>Maidenhead Grids</name>\n";
my $i = 0;
my $step_lat = 2;
my $step_lon = 1;
for (my $lat = -180; $lat < 180; $lat+=$step_lat) {
   my $j = 0;
   for (my $lon = -90; $lon < 90; $lon+=$step_lon) {
      print FH "   <Document>\n";
      print FH "      <name>".chr((($lat+180)/20)+65).chr((($lon+90)/10)+65).((($lat+180)/2)%10).(($lon+90)%10)."</name>\n";
      print FH "      <Placemark>\n";
      print FH "         <LineString>\n";
      print FH "            <coordinates>\n";
      print FH "               ".$lat.",".$lon.",0 ".$lat.",".($lon+$step_lon).",0 ".($lat+$step_lat).",".($lon+$step_lon).",0 ".($lat+$step_lat).",".$lon.",0 ".$lat.",".$lon.",0\n";
      print FH "            </coordinates>\n";
      print FH "         </LineString>\n";
      print FH "      </Placemark>\n";
      print FH "   </Document>\n";
      $j += 1;
   }
   $i += 1;
}
print FH "</Folder>\n";
print FH "</kml>\n";

exit 0;

The result is available on [2]. The .kml file is probably too large to be included within aprs.fi. So the .kml is just zipped to a .kmz file. This can now be included to show the maidenhead gridsquare overlay on aprs.fi. You simply add an URL parameter called kml and assign the .kml/.kmz file which has to be on a public web server. This way you can for example track a rover driving through grids:

DL2GRC-9 moving through JN54 grid square
DL2GRC-9 moving through JN54 grid square

The overlay can of course also be used within a general station overview:

aprs.fi with Maidenhead Grid Overlay
aprs.fi with Maidenhead Grid Overlay

The link for the latter map can be found on [3]. This simply includes the .kmz file generated with the above code and zipped afterwards (there is some URL encoding in place to encode special characters of the URL within the kml parameter).

References

[1] https://twitter.com/supercazzola/status/1135640384380559361
[2] https://www.df2et.de/aprs.fi/
[3] https://aprs.fi/#!mt=osm&z=9&kml=https%3A%2F%2Fwww.df2et.de%2Faprs.fi%2Fmaidenhead_gridsquares.kmz&call=&others=1&timerange=3600&tail=3600&addr=JO31