#!/usr/bin/perl # Do some Burkle calculations for North Dakota road names # Author: Dan Jacobson https://www.jidanni.org/ # Copyright: https://www.gnu.org/licenses/gpl.htm # Created: 2023-12-06T04:10:04+0000 # Last-Updated: 2023-12-08T20:19:50+0000 # Update #: 44 # use strict; use warnings q(all); use PointId2Address; =head1 Computations How many miles up and over, is a given point, from the Burkle origin? OK, the origin ND051460N0780W0_700100. We are using the township on the west to get their usually more dependable east sides, hence the 7. But wait, they should be the same point as the one on the east's _100100, well never mind. We can crunch them all the same. =cut my %g; $g{origin}{id} = "ND051460N0780W0_700100"; while (<>) { chomp; my @F = split /,/; $g{target} = { id => $F[2] }; #we wipe out the previous {target}{miles} my @a = PointId2Address::point_id_diff( \%g ); print join ",", @F[ 0, 1 ], label(@a); print "\n"; } sub label { my @v = ( [qw/E W/], [qw/N S/] ); for ( 0, 1 ) { if ( $_[$_] ) { return ( abs $_[$_] ) . " " . $v[$_][ $_[$_] < 0 ]; } } return 0; #origin }