#!/usr/bin/perl # PLSS point ids to addresses, for Las Animas County, Colorado. # First time I've seen this road numbering system... # Author: Dan Jacobson https://www.jidanni.org/ # Copyright: https://www.gnu.org/licenses/gpl.htm # Created: 2023-11-20T22:22:01+0000 # Last-Updated: 2023-12-31T10:27:46+0000 # Update #: 271 # use strict; use warnings FATAL => q!all!; use PointId2Address; # Even road numbers for roads running east - west! odd for roads # running north-south! But that's just the tip of the iceberg. Yes, a # regular, but very special system, of numbering roads at least. my %g = ( origin => { id => "CO060350S0690W0_100400", # actually in New Mexico }, num_per_mile => [ (1000) x 2 ] ); while (<>) { my $pq; # Print queue chomp; my @F = split /,/; $g{target} = { id => $F[2] }; my @a = PointId2Address::id2addr( \%g ); $pq .= join ",", @F[ 0, 1 ], ""; # Coordinates. if ( $F[2] =~ /CO060310S......_...100/ ) { # Our E/W line. $pq .= $a[0] . " "; # Address. my $road_number = 2 * int( $a[0] / 1000 ) - 1 + ( $a[0] % 1000 ) / 1000; ## ...which is the mind-bendingly unique way of relating road ## numbers to addresses on east-west roads for this county. if ( $road_number > 0 ) { $pq .= $road_number; } else { $pq .= "-" } ## ...a world of trouble for no gain. ## Mountain area not worth negative road number complication. } else { # Our N/S lines. County is wide, so using two. $pq .= $a[2] . " "; # Address. my $road_number = 2 * int( $a[2] / 1000 ) + ( $a[2] % 1000 ) / 1000; ## Slightly less mind bending on north-south roads, but still plenty mind-bending. if ( $road_number > 0 ) { $pq .= $road_number; } else { next; } ## Ha! No more troublesome stunted point on New Mexico border! } print "$pq\n"; } # https://lasanimascounty.colorado.gov/misc/county-maps > Parcels and Subdivisions etc. # Never mind getting distorted addresses from Google Maps. This site: # https://lasanimas.maps.arcgis.com/apps/webappviewer/index.html?id=b0374b9d300248629cab2ab88ac79277 # has genuine government address points.