DS =\ -dsco NAME="Example of single folded axis in street naming, Manila South Cemetery." \ -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-07-04T22:25:17+0000 ## Last-Updated: 2025-07-05T11:26:02+0000 ## Update #: 72 P=smc v=viking $P.vik: # Ground control points. "X","Y",lat,lon: G:=$G B M 14.568237 121.018253 G:=$G B Q 14.566825 121.021997 G:=$G J O 14.563790 121.018703 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,1]), @F[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 %.single_axis.csv:%.xyz; $K -fl 1 #1=A #oops, rotated: W=0 E=10 S=0 N=17 $P.%.xyz:Makefile perl -wle "for([$W,$N],[$E,$N],[$W,$S],[$E,$S]){print qq(@\$$_ @\$$_[$*])}" > $@ $P.%0.kml:$P.%.csv $P.optfile Makefile ogr2ogr -f LIBKML $@ $< --optfile $P.optfile -clipsrc 2 13 10 17 -sql \ 'SELECT Name FROM "$(basename $<)"' $P.%.single_axis0.kml:$P.%.single_axis.csv $P.optfile ogr2ogr -f LIBKML $@ $< --optfile $P.optfile -clipsrc 1 1 13 18 -sql \ 'SELECT Name FROM "$(basename $<)"' -simplify 999999 %.kml:%0.kml; perl -wlpe 's!()(\d+)()!$$1 . (chr($$2+64)) . $$3!e;' $< > $@ sak=$P.0.single_axis.kml $P.1.single_axis.kml single_axis:$(sak); $v $^ %.kmz: %.1.kml %.0.kml %.0.single_axis.kml %.1.single_axis.kml ogrmerge -f LIBKML -overwrite_ds -o $@ $^ $(DS) .SECONDARY: .PRECIOUS: %.kmz %.vik:%.kmz; viking $< && sleep 11111 clean:; rm *.xyz *.km? *.csv *.optfile # P.S., we notice the Cemetery is laid out on 290 deg azimuth.