### Makefile --- PLSS corners and half mile corners along the ## southern border of N. Dakota.. predicting where the granite ## boundary markers might be. ## Author: Dan Jacobson https://www.jidanni.org/ ## Copyright: https://www.gnu.org/licenses/gpl.html ## Created: 2023-11-25T03:27:22+0000 ## Last-Updated: 2023-12-11T00:45:36+0000 ## Update #: 473 ## U = ../../../house_numbering/grids/utilities export PERLLIB = $U export PATH := $U:$(PATH) G=https://www.google.com/maps/search D=~/Downloads KO = -f LIBKML \ -dsco NAME="N/S Dakota Boundary Monuments estimations" \ -dsco DESCRIPTION="Possible locations from BLM PLSS data. See\ https://www.jidanni.org/geo/borders/n_s_dakota/plss/" CO= -oo HEADERS=NO \ -oo KEEP_GEOM_COLUMNS=NO \ -oo X_POSSIBLE_NAMES=field_1 \ -oo Y_POSSIBLE_NAMES=field_2 \ -sql 'SELECT field_3 AS Name FROM "$(basename $<)"' nsdakmon.vik: rebug.csv:d.json $U/PLSS_corners.pm # filter=$$(echo 192.5|../ndsd|perl -nwle 'print for /ND0\w*/g;') $(DF) perl -MPLSS_corners -we 'PLSS_corners::process()' $? > $@.t mv $@.t $@ #Some files I found, but later didn't use: sc.csv:$D/NDGISHUB_PLSS_Section_Corners.csv perl -F, -anwle 'next unless $$F[1]=~/45\./;print join ",", @F[0,1], "";' $?|\ sort -t , -k 1n > $@ ps:$D/NDGISHUB_PLSS_Sections.csv perl -F, -anwle 'next unless $$F[2] eq 129 && $$F[1]=~/^3./; print;' $?|\ sort -t , -k 5nr -k 2n --debug sb.csv:$D/NDGISHUB_State_Boundary.kml gpsbabel -i kml -o csv -f $? -F -|fgrep 45. |sort -k 2n|sed 630q|tr -d \ |\ perl -F, -awlne 'print join ",", (reverse @F),"";' > $@ %.kmz %.kml:%.csv; ogr2ogr $@ $? $(KO) $(CO) str:a_strip ./$?|head -n 44|$P ./$?|head -n 44|../ndsd %.vik:%.kmz cd /tmp && nohup viking -e $(PWD)/$? & sleep 11 H=N/S Dakota boundary guesses

%.html:%.csv # Make an .html where one can click on each link to visit aerial map: perl -F, -nwle 'BEGIN{print q{$H}};$(\ )printf qq{%s
\n},$(\ )@F[1,0,2];END{print q{

}}' $? > $@ # Code to change labels into monument numbers: P=perl -pwle 's!ND051290N(\d\d\d)0W._(\d)(\d)0100$$!$(\ )( $$1 - 47 ) * 6 + 4 - ( $$2 - 1 ) - $$3/8!e;$(\ )s/\.5$$/½/;s/361$$/360M/;END{print $(\ )"-96.5636814442698,45.9352817333815,IP";}' #We paste the presumed Initial Point back in from our discarded data. #It seems there was no 0.5 nor 360.5... # From shell can override: # $ DF=filter=ND051290N0540WASN320\ stop=1 make -e rebug.csv DF=filter=$$(echo 360.5|../ndsd|perl -nwle 'print for /ND0\w*/g;') Q=ND051290N1070W0_400100 a.csv:d.json; test $$filter && OnePLSSSec $? > $@.t && mv $@.t $@ debug.csv:d.json # filter=ND051290N0900W0SN360 perl -MPLSS_corners -we 'PLSS_corners::process()' $? # $(DF) OnePLSSSec $? > $@.t && mv $@.t $@ filter=$$(perl -MBou2colrow -wle 'print Bou2colrow::xxxyyy2SN_US(q($Q))') \ OnePLSSSec $? > $@.t mv $@.t $@ act: # perl -MMath::Trig -wle '$$m=360/8;for(0..7){my $$r=deg2rad $$m*$$_; printf "%.2f %.2f\n", cos $$r, sin $$r;}' perl -MMath::Trig -wle 'use strict; my @k=(-2,-1,1,2);for my $$x(@k){$(\ )for my $$y(@k){next if abs $$x == abs $$y; print "$$x $$y ", rad2deg atan $$x/$$y;}}'|\ sort -k 3n nsdakmon.csv:cor.csv #now we make MONUMENT MILES for labels: $P $? > $@.t mv $@.t $@ Pc= perl -F, -anwle '$$t="@F[1,0]"; if($$l){print "$$t $$l"}; $$l=$$t;'|\ geod -I +ellps=WGS84 +units=us-mi|sort -k 3nr north_check:nsdakmon.csv;< $? $(Pc) #are the latitudes close to the border? east_check:nsdakmon.csv; < $? $(Pc) #are the longitude intervals consistent? cor.csv:d.json $U/PLSS_corners.pm #We only want the points on the state line # Remove troublemaker sections. Yes, even if we indeed asked for them in make_wants avoid=790W0SN36\|540WASN32\|470W0SN34 \ perl -MPLSS_corners -we 'PLSS_corners::process()' $< > $@.t grep 100$$ $@.t |\ egrep -v 490W0_500100\|1070W0_440100 |\ grep -v _700 | sort -u | sort -t , -k 1n > $@.t2 mv $@.t2 $@ && rm $@.t d.json:make_wants -mv $@ $@.bak ./$< | fetch_blm_sections > $@.t mv $@.t $@ .PRECIOUS:%.kmz