DS =\ -dsco NAME="Fantasy multiple grids, Highland Park IL USA" \ -dsco DESCRIPTION="See $(subst $(HOME)/,https://www.,$(PWD))" ## Author: Dan Jacobson https://www.jidanni.org/ ## Copyright: https://www.gnu.org/licenses/gpl.html ## Created: 2025-06-29T12:31:21+0000 ## Last-Updated: 2025-06-30T14:05:21+0000 ## Update #: 150 ## ## We thought: for places with triangular etc. street patterns, what ## if we gave each direction its own grid? ## Result: Yuck! Do "make" to see it. Conclusion: Just stick to two ## directions, even if our fold is not 90 degrees. Yes, like ## ../images/hp_il_fd_north.jpg ## By the way, a Makefile is no place to write this. I ended up with a ## lot of wasteful repetition. Good thing I'm not going to pursue ## triangular etc. grids anymore. all:r.0.kml r.1.kml t.0.kml t.1.kml clip1.kml viking $^ # Clipping boundary, of the study area we are interested in: C0=42.157734 -87.782842 #South C:=$(C0) C:=$C 42.157734 -87.768903 #E C:=$C 42.168310 -87.771255 #NE C:=$C 42.171189 -87.782627 #N C:=$C 42.168709 -87.792498 #NW C:=$C $(C0) clip1.csv:; echo $C|$F && $G F=xargs --max-args 2 > /tmp/$@ G=ogr2ogr $@ /tmp/$@ -lco GEOMETRY=AS_WKT -dialect SQLite -sql \ 'SELECT "." as Name, $(\ )MakePolygon(MakeLine(MakePoint(field_2+0, field_1+0))) AS WKT FROM $(basename $@)' clip%.kml:clip%.csv; ogr2ogr -f LIBKML $@ $< -sql 'SELECT Name FROM "$(basename $<)"' # Ground control points: # Regular (NSEW) grid: r:=$r 5400 7500 42.167786 -87.776748 #Rice/Cary r:=$r 5500 7400 42.165416 -87.772607 #Sheridan/Roger Williams r:=$r 5400 7400 42.165464 -87.776791 #Rice/Roger Williams # Tilted grid t:=$t 1500 3200 42.163508 -87.786919 #Highland/Green Bay t:=$t 1500 3350 42.164907 -87.783851 #Highland/Burton t:=$t 1650 3300 42.162410 -87.783185 #Washington/Pleasant r.0.optfile r.1.optfile:; echo $r | xargs --max-args 4 | perl -anwle 'print qq(-gcp @F[0,1,3,2])' > $@ t.0.optfile t.1.optfile:; echo $t | xargs --max-args 4 | perl -anwle 'print qq(-gcp @F[0,1,3,2])' > $@ %.csv:%.xyz; gdal_contour -i 100 -q -a Name $< $@ -lco GEOMETRY=AS_WKT %.single_axis.csv:%.xyz; gdal_contour -fl 0 -q -a Name $< $@ -lco GEOMETRY=AS_WKT clean:; rm *.xyz *.km[lz] *.csv *.optfile N=10000 E=$N S=0 W=$S %.0.xyz:; perl -wle "for([$W,$N],[$E,$N],[$W,$S],[$E,$S]){print qq(@\$$_ @\$$_[0])}" > $@ %.1.xyz:; perl -wle "for([$W,$N],[$E,$N],[$W,$S],[$E,$S]){print qq(@\$$_ @\$$_[1])}" > $@ %.kml:%.csv clip1.csv %.optfile ogr2ogr -f LIBKML $@ $< --optfile $*.optfile -clipdst clip1.csv -sql \ 'SELECT Name FROM "$(basename $<)"' .SECONDARY: