#!/usr/bin/perl # PLSS point ids to addresses, for Deerfield / Bannockburn, Illinois # Author: Dan Jacobson https://www.jidanni.org/ # Copyright: https://www.gnu.org/licenses/gpl.htm # Created: 2024-01-27T00:32:31+0000 # Last-Updated: 2024-01-27T02:39:13+0000 # Update #: 21 # use strict; use warnings q(all); use PointId2Address; my %grid = ( origin => { id => "IL030430N0120E0_400100", }, num_per_mile => [ (800) x 2 ] ); sub f { #first trim edges if ( $_[3] eq "S" ) { return unless $_[2] <= 200; } elsif ( $_[3] eq "N" ) { return unless $_[2] <= 2800; } if ( $_[1] eq "E" ) { return unless $_[0] <= 300; } if ( $_[2] == 0 ) { #Lake Cook Rd. if ( $_[1] eq "E" && $_[0] ) { return join "", @_[ 0, 1 ]; } else { return $_[0]; } } return $_[2] . ( $_[3] eq "S" ? "S" : "" ); } while (<>) { chomp; my @F = split /,/; $grid{target} = { id => $F[2] }; #we wipe out any previous {target}{miles} my $p = f( PointId2Address::id2addr( \%grid ) ); if ( defined $p ) { printf "%s,%s,%s\n", @F[ 0, 1 ], $p; } }