DS =\ -dsco NAME="Kamuning / Kamias Quezon City street name grid." \ -dsco DESCRIPTION="See $(subst $(HOME)/,https://www.,$(PWD))" #Here our single axis is simply the 0 axes... ## Author: Dan Jacobson https://www.jidanni.org/ ## Copyright: https://www.gnu.org/licenses/gpl.html ## Created: 2025-10-14T20:14:14+0000 ## Last-Updated: 2025-10-15T03:09:48+0000 ## Update #: 82 P=k v=viking $P.vik: # Ground control points. xABC,y123,lat,lon: G:=$G L 0 14.634527 121.058851 #Anonas / Kamias Road G:=$G K 5 14.632039 121.057167 #Kasing-Kasing / K-9th Street, but we call it 5 anyway G:=$G J 0 14.633203 121.054334 #K-J St. / Kamias Road G:=$G A 0 14.627437 121.034336 #L. Sanghio St. / Kamuning Road G:=$G A 5 14.625475 121.034925 #L. Sanghio St. / where K-5th should have met it see_gcps:$P.kml; $v $< %.csv:%.optfile; perl -anwle 'printf "%s,%s,%s/%s\n", @F[3,4,1,2];' $< > $@ $P.kml:$P.csv; ogr2ogr -f LIBKML $@ $< -oo X_POSSIBLE_NAMES=field_1 \ -oo Y_POSSIBLE_NAMES=field_2 -sql 'SELECT field_3 AS Name FROM "$(basename $<)"' $P.optfile:Makefile; echo $G|xargs --max-args 4|perl -anwe \ 'print join " ","-gcp", map((ord)-64, $$F[0]), @F[1,3,2]; print $$/;' > $@ # Drape contours over the wedge. Our own version of "gdal_create # -outsize 2 2". (Makes four points per line, we actually only want # the middle two, but will get clipped or {-simplify}ed anyway.): K=gdal_contour -q -a Name $< $@ -lco GEOMETRY=AS_WKT %.csv:%.xyz; $K -i 1 W=0 E=13 S=0 N=6 #err, downwards. $P.%.xyz:Makefile perl -wle "for([$W,$N],[$E,$N],[$W,$S],[$E,$S]){print qq(@\$$_ @\$$_[$*])}" > $@ $P.%0.kml:$P.%.csv $P.optfile Makefile #.01 to avoid multigeometry, .5 to pull viking labels over ogr2ogr -f LIBKML $@ $< --optfile $P.optfile -clipsrc -0.01 -0.9 13.5 6 -sql \ 'SELECT Name FROM "$(basename $<)"' $P.1.kml:$P.10.kml; cp $< $@ #No number to letter translation needed for this axis R=s!()(\d+)()!$$2?($$1 . (chr($$2+64)) . $$3):$$&!e; print; # $$2?: avoid ASCII 0=@ %.kml:%0.kml; perl -wlne '$R' $< > $@ %.kmz: %.0.kml %.1.kml; ogrmerge -f LIBKML -overwrite_ds -o $@ $^ $(DS) .SECONDARY: .PRECIOUS: %.kmz %.vik:%.kmz; viking $< && sleep 11111 clean:; rm *.xyz *.kml *.csv *.optfile azimuth=73.5 #Kamuning & Kamias Roads #convert $? -rotate $$(perl -we 'print 90-$(azimuth)') $@ #for JPG image L=250#Observed average east west block length A=100 blocks: @perl -we \ 'printf "East-west block averaged length = $Lm.\n$(\ )If we choose $A addresses per block, %s on each side.\n$(\ )Then on each side we have %s meters per address.\n$(\ )We might as well use the same rate for north-south streets.", $A/2, $L/($A/2);' npb=200 #Try various numbers per east-west block: EW:; perl -we 'for (1..12){printf "K-%s St. => K-%s Rd.\n", chr($$_+64), ($$_-6)*$(npb)+2500;}' NS:; perl -we 'for (0..6){printf "K-%s St. => K-%s Rd.\n", $$_, int($$_*-$(npb)/6+7500);}'