### Makefile --- N=Xinshe District, Taichung City, Taiwan DESC1=Address / road name calculations. ## Author: Dan Jacobson https://www.jidanni.org/ ## Copyright: https://www.gnu.org/licenses/gpl.html ## Created: 2024-04-13T08:05:54+0000 ## Last-Updated: 2024-04-17T11:24:43+0000 ## Update #: 493 # See ../../../define.html#xinshe U = ../../../utilities export WeSnLimit=2500 #Roads >= this are E-W, else N-S. export PERLLIB = $U alladr.00.vik: include $U/m1.makefile *.makefile G=gdaltransform -output_xy #Let's make some axes on the plateau, Center=24.212141 120.803198 # 6R63+V74 協成里 Taichung City, Xinshe District (Plus Code) ce=1000 6000 $(lastword $(Center)) $(firstword $(Center)) South=24.209020 120.803166 so=1000 5700 $(lastword $(South)) $(firstword $(South)) North=24.230673 120.803445 no=1000 7800 $(lastword $(North)) $(firstword $(North)) Bsn=21 #count of short blocks N/S West=24.212259 120.790356 we=300 6000 $(lastword $(West)) $(firstword $(West)) East=24.212073 120.814270 ea=1600 6000 $(lastword $(East)) $(firstword $(East)) Bwe=13 #count of long blocks E/W F=set $$(echo $$1 $$2 $$3 $$4 | geod +ellps=WGS84 -I -f %.6f |\ perl -awnle 'print $$F[0], " ", $$F[-1] / '$$5);\ echo az=$$1 length=$${2}m block_lengths_and_azimuths: @set $(West) $(East) $(Bwe); $F @set $(South) $(North) $(Bsn); $F SHELL=/bin/bash fen: perl -wle 'print 186.874846153846 * 114.213523809524'|\ xargs -I{} units {}m2 分 #22.005622 ! 2024. 22: # units 186.874846153846m/11 ken # units 114.213523809524m/2 ken # I need to analyze the sizes of the full sugar blocks on the NLSC maps.... # A Utah style addressing grid. But we move the origin off the map, so # no need for N., S., E., W. Also we make full use of the [9999] # numbers we plan to use, where you can determine the direction of the # road from its number... But not odd roads N.S. instead lower # numbered roads N.S.. On Openstreetmap layers for this area we also # see the, alas, inferior current local house numbers scattered # around. # Let's make our own addressing system! extraKMZs=area1.00.kmz area2.00.kmz area3.00.kmz zhongxingling.00.kmz \ xiaping.00.kmz xinercun.00.kmz xinsancun.00.kmz alladr.00.kmz:$(extraKMZs) ogrmerge.py -overwrite_ds -o $@ $$(ls $^|tac) %.00.csv:%.lonlat %.targets #Utah style! paste $^ | perl -awnle \ 'for($$F[4]){die unless defined;$(\ )if(/ew/){$$label=$$F[2]}elsif(/ns/){$$label=$$F[3]}elsif(/x/)$(\ ){$$label=join "/", @F[2,3]}else{$$label=$$_}}$(\ )print join ",", @F[0,1], $$label;' $C # Area1 ground control points A1GCPs=-gcp $(ce) -gcp $(so) -gcp $(no) -gcp $(we) -gcp $(ea) \ -gcp 1700 3800 120.815894 24.189259 -gcp 700 6700 120.797792 24.219434 \ -gcp 400 6600 120.792225 24.218430 %.lonlat:%.targets $G $(A1GCPs) < $< $C area1.targets: #The main part of Xinshe plateau. #.targets files: Here's where we added our favorite spots to put grid ticks! perl -wle '$P;f([0..1600],6250); f(970,[5700..8000]);$(\ )f(1650,[4100..5700]);f(1720,[3600..4000]); f(350,[5500..6600]);$(\ )f([1400..2100],4650); f([600..1200],7130)' $C area2.lonlat:area2.targets $G -gcp 2000 3300 120.821440 24.184178 -gcp 2000 2700 120.820797 24.178061 \ -gcp 1900 3000 120.819338 24.181286 < $< $C area2.targets: perl -wle '$P; f(1950,[2700..3700]); f([1800..2000],3050)' $C area3.lonlat:area3.targets $G -gcp 1300 7900 120.809028 24.231993 \ -gcp 1300 7700 120.809543 24.229997 \ -gcp 1400 7600 120.811968 24.229518 < $< $C area3.targets: perl -wle '$P; f(1350,[7300..8200]);f([1200..1400],7950);$(\ )f(1680,[7050,7150,7200,7280,7340,7420,7480,7585,7610],1);' $C zhongxingling.lonlat:zhongxingling.targets $G -gcp 1000 5400 120.801976 24.206769 \ -gcp 700 5100 120.795603 24.207983 -gcp 1600 5100 120.807612 24.197629 < $< $C zhongxingling.targets: perl -wle '$P; f(850,[4900..5500]); f([700..1600],5150); f(1530,[4800..5300]);$(\ )f(2000,[4900..5090],19,7);f(2000,[4800,5110],1);f([1960,2035,2100],5000,1);' $C xinsancun.lonlat:xinsancun.targets $G -gcp 1250 7100 120.807112 24.223407 -gcp 1250 6900 120.807720 24.221202 \ -gcp 1200 6900 120.807227 24.221043 < $< $C xinsancun.targets: perl -wle '$P; f([1250,1270,1290,1315],6925,1);f(1260,[6900,6980,7100],1);' $C xiaping.lonlat:xiaping.targets $G -gcp 2100 3800 120.823771 24.189371 \ -gcp 2200 3900 120.825617 24.190453 -gcp 2100 3600 120.823890 24.187311 \ -gcp 2100 4000 120.823771 24.191336 < $< $C xiaping.targets: perl -wle '$P; f(2120,[3300..4000]); f([2000..2200],3830)' $C houses.addresses: printf "6000 路1146號\n\ 6100街 1043號\n\ 1100路 6158號\n\ 1100路6051號\n" $C houses.targets:houses.addresses addr2xy #odd numbers on north and east sides of street ./addr2xy $< $C a1+houses.kmz: area1.00.kmz houses.00.kmz ogrmerge.py -overwrite_ds -o $@ $^ a1+houses.vik: houses.00.vik: quiz:hnum @echo Q: What would approximately be the new number of 209之3號? @printf 'A: ' @echo 120.804426 24.215551 | $G -i $(A1GCPs)|./$< C= > $@.t && test -s $@.t && mv $@.t $@ yuck=*.csv *.lonlat *.targets *.t *.addresses *.twd?? *.pseudo_twd67 clean:; rm $(yuck) $(extraKMZs) kclean:; rm $(yuck) *.kmz extent.targets: perl -wle '$P; my $$i=250; f([0..2499],6050,$$i);f([2499],6050,1);$(\ )f(1950,[2500..5999],$$i);f(0,[6000..12000],$$i);' $C extent.00.vik: xinercun.targets: #Just an experiment in a dense community perl -wle '$P; f([568],6580,1);f([490..650],6615,12);$(\ )f(520,[6600,6685,6730],1);f(675,[6700])' $C #It also shows that we shouldn't expect side roads to be numbered odd or even depending on side, #unlike Taiwan lane numbers 巷弄號碼, because our roads numbers are all the same hierarchy and should be # considered through roads, even if they are dead ends, currently... P=BEGIN {\ use strict;\ sub f {\ my $$interval = $$_[2] || 100;\ my $$shift = $$_[3] || 0;\ for my $$m ( 0,1 ) {\ if ( ref \$$_[$$m] eq "SCALAR" ) {\ for ( @{$$_[ !$$m ]} ) {\ unless ( $$_ % $$interval ) {\ printf "%s %s %s$$/", !$$m ? ($$_[$$m], $$_ + $$shift,"ns") :\ ($$_ + $$shift, $$_[$$m],"ew") \ }\ }\ last;\ }\ }\ }\ }\ NewMakefile: Makefile #Let's say we need to shift our origin... perl -pwle 'next if /^#|WeSnLimit=/; s/\b\d{4}\b/$$&-1500/ge;' $< $C #but now below 1000, so \d{4} won't catch some...