[aprssig] RaspberryPI Parser for Grid Squares?

Carl Makin carl at stagecraft.cx
Fri Oct 21 10:31:05 EDT 2016


Hi Bob,

> On 22 Oct. 2016, at 12:26 am, Robert Bruninga <bruninga at usna.edu> wrote:
> 
> Looking for a Raspberry Pi programmer to do the following:
> 
> * Scan a .TXT file looking for a grid square in this format "GRD:XX"
> * Converting that XX grid to a LAT/LONG
> * Returning that LAT/LONG to the nearest degree

Something like this would do it;

pi-locator.pl
———————— Cut Here ————————
use Ham::Locator;

my $m = new Ham::Locator;
my $loc;

while (<>) {
    next unless m/.*GRD:(..).*/;
    $loc = $1;
    last;
}
print "locator: $loc - ";
$m->set_loc($loc);

my ($latitude, $longitude) = $m->loc2latlng;
print "Lat: " . int($latitude) . " - Long: " . int($longitude) . "\n";

———————— Cut Here ————————


$ cat input
kaaslkas asd
asg
sGDsdgklgs
lkasdk GRD:QF alkdflnaksgdklja
aslkaglkna
sDLJGL Nsgd
.
$

$ perl ./pi-locator.pl input
locator: QF - Lat: -34 - Long: 150
$


> If this seems to work, then we will next make sure the DATE and TIME of
> the contact are also parseable…


Just more easy parsing in perl.

Carl.
(vk1kcm)




More information about the aprssig mailing list