N=Vermilion Co. IL address / road name grid
DESC1=Using PLSS data.
## Author: Dan Jacobson https://www.jidanni.org/
## Copyright: https://www.gnu.org/licenses/gpl.html
## Created: 2024-05-11T16:17:42+0000
## Last-Updated: 2024-05-15T09:18:04+0000
##     Update #: 77

U = ../../../../utilities
include $U/m1.makefile $U/m2.makefile
export PERLLIB = $U
export PATH := $U:$(PATH)
L=~/Downloads
b=$L/boundaries
I=vermilion_co_il
$I.vik:
sn_label.csv:f; ./$< $C
$L/$I.json: #sn_label.csv #uncomment to refresh...
	test x$< != x # Catch if we forgot to uncomment $< above, for first run
	perl -F, -awnle 'push @o, $$F[0]; END{print join "%7C", @o;}' $< | fetch_blm_sections $C
lon_lat_sn_online.json: $L/$I.json; cp $< $@
lon_lat_sn.csv:blanket.csv lon_lat_sn_online.csv
	sort -t , -k 3,3 $^ $C
lon_lat_label.csv: lon_lat_sn.csv sn_label.csv
	join -t , -1 3 -o 1.1,1.2,2.3 $^ > $@.tmp
	: Here, if anything, are the serious cases, where we don\'t have the data to place our points:
	join -t , -1 3 -o 1.1,1.2,2.3 -e MISSING -v 2 $^ | tee /tmp/errr_A
	: Here, if anything, is no big deal, where we merely got more data than we use:
	join -t , -1 3 -o 1.1,1.2,2.3 -e MISSING -v 1 $^ | tee /tmp/errr_B
#	! test -s /tmp/errr_A
	mv $@.tmp $@
osmid=1801537
R=$b/$I.kml #https://www.openstreetmap.org/relation/1801537
$R:; fetch_boundary $(osmid) - $C
$I.kmz: $R lon_lat_label.kmz
	ogrmerge.py $(KO) -overwrite_ds $^ -o $@
clean:; rm *.csv *.tmp lon_lat_label.kmz
# https://www.mapofus.org/tag/County-Maps/
m=https://www.mapofus.org/_maps/dot
edgar.pdf vermilion.pdf:
	cd $L && wget $m/il/$@
# https://idot.illinois.gov/content/dam/soi/en/web/idot/documents/transportation-system/maps---charts/highway/county/vermilion.pdf
# https://clearinghouse.isgs.illinois.edu/data/reference/illinois-public-land-survey-system-plss-boundaries
%.csv:%.json
	perl -MPLSS_corners -wle 'BEGIN{$$,=q(,)};%h=PLSS_corners::centers; for(keys %h)$(\
	){print @{$$h{$$_}}{qw/lon lat/},$$_}' $< $C
#blanket:f
#	./$< --$@|perl -gae 'print join "%7C", @F;'| fetch_blm_sections $C
####################
# https://gdal.org/drivers/vector/sqlite.html
# https://gdal.org/drivers/vector/sqlite.html#using-the-spatialite-library-spatial-extension-for-sqlite
#ogr2ogr -f SQLite testspatialite.sqlite test-2.3.sqlite  -dsco SPATIALITE=YES