#!/usr/bin/perl # PLSS point ids to addresses, for Hildale UT # Author: Dan Jacobson https://www.jidanni.org/ # Copyright: https://www.gnu.org/licenses/gpl.htm # Created: 2024-04-04T00:41:49+0000 # Last-Updated: 2024-04-13T20:45:26+0000 # Update #: 67 # use strict; use warnings q(all); use PointId2Address; my %grid = ( version => 2, #One day this will need a version number. location => { ## Let's say one day we want to fit this into some grand ## schema. See https://github.com/agrc/gis.utah.gov/issues/2723 . COUNTRY => "US", STATE => "UT", COUNTY => "WASHINGTON", # Like https://gis.utah.gov/data/address/address-grids/ GRID => "HILDALE", sector => { id => 0, # e.g., Chicago would have several sectors: # 0-1200 S, 1200-2200 S are different numbers per mile than # others. "Indian Boundary Lines" on the other hand would NOT # necessarily cause a different sector, as the addressing grid # automatically jogs along with the PLSS upon crossing. # Also, again for Chicago, several of its neighboring # towns share the same grid. Thus grid districts might be # larger than political districts. bounding_box => { #PLSS=> ... define via PLSS or #lonlat => } } }, visible => 1, #yes, can be seen on the ground, not solely on paper or in theory. type => { addressing => 1 #not e.g., utility pole numbers , #road_naming=>1 #didn't see any "900 North" type names here, just "Franklin Av." types. }, system => 'PLSS', #not simply defined on top of e.g., WGS84. origin => { # Some place where we will anchor the address grid to the PLSS # We picked the corner of Homestead St. and Utah Av. # Yes, usually we would just pick 0 North and 0 East, # but that even lies in another state in this case! id => 'UT260430S0100W0_360140', address => [ -500, 800 ] }, num_per_mile => [ (800) x 2 ], # Yes, usually square grids. #km_per_mile => ); ## Shall we show quarter section points along with half? my $filter = $ENV{thin} ? "04" : "0246"; $filter = qr/_.[$filter]0.[$filter]0$/; while (<>) { next unless /\d/; #Skip CSV headers chomp; my @F = split /,/; ## We just want Hildale: next unless $F[2] =~ /^UT260430S0100W0_[2345]..[12]..$/; ## Arizona border "repair" for truncated sections... But see also ## https://github.com/agrc/plss/issues/350 . $F[2] =~ s/100$/120/; next unless $F[2] =~ $filter; # Weed out irregulars and undensify $F[2] =~ /(...)(...)$/; ## Refine limits, next if $1 > 520; next if $2 > 250; ## (We could even refine based on address themselves, after we compute @p.) $grid{target} = { id => $F[2] }; #we wipe out any previous {target}{miles} my @p = PointId2Address::id2addr( \%grid ); die "No address for $_" unless @p; $F[4] -= 0.00083; #A hack to make my KMZ more beautiful. # Makes the points line up with the section corners on most of # today's map backgrounds. I should really investigate why this is # one day. printf "%s,%s,%s%s %s%s,%s\n", @F[ 4, 5 ], @p, $F[2]; } ## Hildale Utah Google StreetView corner signage observations: ## Box_Elder St. 1400 W ## Juniper St. 800 W ## Memorial St. 400 E ## Field Av. 700 N ## Utah Av. 800 N ## Newell Av. 900 N ## Jessop Av. 1000 N