#!/usr/bin/perl # PLSS point ids to addresses, for DuPage Co. IL # Author: Dan Jacobson https://www.jidanni.org/ # Copyright: https://www.gnu.org/licenses/gpl.htm # Created: 2023-12-13T05:22:29+0000 # Last-Updated: 2023-12-15T01:37:16+0000 # Update #: 9 # use strict; use warnings q(all); use PointId2Address; # https://library.municode.com/il/dupage_county/codes/code_of_ordinances?nodeId=CH35UNAR # mber the first section 15 W. 1 to 800, the second section 16 W. 1 to my $num_per_mile = 800; #Using Madison Street, Chicago, extended as a base line or zero, my $state_and_madison = "IL030390N0140E0_400500"; #number North and South, the first section, north, being N. 1-800, the #second section, 1N. 1 to 800, and in the same manner to the northern #boundary of the County, the first section south of the base line #being S. 1 to 800, the second section 1S. 1 to 800, and in the same #manner to the southern boundary of the County. # So no "0N222" ? No, plenty: 0S481 MORNINGSIDE AV, 0N365 HIGH LAKE AV. Good. my %grid = ( origin => { #Chicago id => $state_and_madison, }, num_per_mile => [ ($num_per_mile) x 2 ] ); while (<>) { chomp; my @F = split /,/; my @fn; if ( $F[2] =~ /0380N0..0E0_.00100/ ) { #south edge of county @fn = ( 0, 1 ); } #Yes, the point at the origin qualifies for both labels, but we only give it one. elsif ( $F[2] =~ /...0N0090E0_100.00/ ) { #west edge of county @fn = ( 2, 3 ); } else { warn "$F[2] skipped. Didn't I filter earlier?"; next; } $grid{target} = { id => $F[2] }; #we wipe out any previous {target}{miles} my ( $raw_num, $let ) = ( PointId2Address::id2addr( \%grid ) )[@fn]; my ( $mi, $rest ) = ( $raw_num / $num_per_mile, $raw_num % $num_per_mile ); printf "%s,%s,%d%s%03d", @F[ 0, 1 ], $mi, $let, $rest; ## print ",$F[2]"; #debugging print "\n"; }