### Makefile --- Explore house addressing grids of Orange County CA USA ## Author: Dan Jacobson https://www.jidanni.org/ ## Copyright: https://www.gnu.org/licenses/gpl.html ## Created: 2026-03-07T14:14:49+0000 ## Last-Updated: 2026-03-15T05:09:41+0000 ## Update #: 220 ## # Pick any grid interval that you like, 100 numbers (50 on each side), 150, 340, whatever. # Interval between grid lines, in house numbers. No odd numbers please though: i=1000 # Pick 1, 2,... number of rectangles, or let's call them grid squares # you want, to either side of the central column. # E.g., s=3 gives 3 grid lines to the north, 3 to the south, 3 to the # east, and 3 to the west. s=3 # Pick where in the grid shall the map be centered on. There must be a grid intersection there! x=2000 y=12000 # All I did was explore "district 2" (This system is rotated 225 deg. from north.) d=$i*$s h=$i/2 clip=-clipsrc $$(($x-$d-$h)) $$(($y-$d-$h)) $$(($x+$d-$h)) $$(($y+$d-$h)) # See, our Viking labels always end up in middle between grid squares! # What about a city where houses start at 100n and s? ... so use -offset? MAPS=0.gpx 1.gpx look:$(MAPS); > /tmp/$(VIEWER)errs.txt $(VIEWER) $^ & sleep 11h S=-dialect SQLite -sql R=ogr2ogr $@ $< -nln $(basename $@) N=$(basename $<) SHELL=/bin/bash# -x VIEWER=viking check:; perl -wle 'die qq{\$$i needs to be even} if $i % 2;$(\ )for($x,$y){die qq{$$_ not on a line} if $$_ % $i;}' MAKEFLAGS+=--warn-undefined-variables # 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.): wedge=for([$x-$d,$y+$d],[$x+$d,$y+$d],[$x-$d,$y-$d],\ [$x+$d,$y-$d]){print qq(@\$$_ @\$$_[$*])} %.xyz:check; perl -wle "$(wedge)" > $@ %.csv:%.xyz; gdal_contour -i $i -q -a Name $< $@ -lco GEOMETRY=AS_WKT %.gpkg:%.xyz; gdal_contour -i $i -q -a Name $< $@ -nln $N # %.kml:%.csv gcps.txt # set -x; $R -f LIBKML --optfile gcps.txt \ # $(clip) -sql 'SELECT Name FROM "$N"' clean:; rm -vf *.xyz *.km? *.csv *.txt *.gpkg *.gpx GCP+=1600 12500 33.749413 -117.797475 GCP+=1000 12500 33.7549146 -117.8053976 GCP+=2000 13000 33.7400619 -117.7976047 GCP+=1500 14000 33.733410 -117.815298 gcps.txt: set -- $(GCP); while test $$# -gt 0;\ do echo -gcp $$1 $$2 $$4 $$3; \ shift 4; done >$@ gcps.gpkg:gcps.txt $R -if CSV -nlt POINT $S \ 'SELECT MakePoint(field_4+0,field_5+0) AS geom, '\ 'CONCAT(field_2,"/",field_3) AS name FROM $N ORDER by name' %.gpx:%.gpkg gcps.txt set -eu; set -- $$(ogrinfo -q $<); shift 2; case $$@ in \(Point\)) n=POINT;;\ *Multi\ Line\ String*) n=MULTILINESTRING;; *Line*) n=LINESTRING;;\ *Polygon*|*Multi*) echo No $$@ allowed in GPX! 1>&2; exit 67;; \ *) echo $< --\> $@: Not ready for type \"$$@\" 1>&2; exit 54;; esac;\ $R -nlt $$n $S 'SELECT name, geom AS geometry FROM "$N"' --optfile gcps.txt $(clip) origin.gpx: gcps.txt ogr2ogr $@ :memory: -nlt point -nln $(basename $@) $S \ 'SELECT MakePoint(0,0) AS geom,"0,0" AS name' --optfile $< .SECONDARY: .DELETE_ON_ERROR: # Sent to me 3/2025 in a PDF scan, by the # CLERK OF THE BOARD OF SUPERVISORS # [see also Ordinance 3283] # RESOLUTION [81-1439] OF THE BOARD OF SUPERVISORS OF # ORANGE COUNTY, CALIFORNIA September 29, 1981 # WHEREAS, Section 7-1-1 requires that this Board establish a # numbering system by resolution; # NOW, Therefore, BE IT RESOLVED that : # 1. The County be divided into two districts as follows: # a. District No. 1: A11 of the County of Orange, State of # California, excepting therefrom that portion included within the # exterior boundaries of Irvine's Subdivision # b. District No. 2: That portion of the County of Orange, # State of California included within the exterior boundaries of # Irvine's Subdivision, # 1000 numbers per mile... # Numbers allotted to property fronting on a road shall # progress from West to East or from North to South, with even # numbers allotted on the East or South side of the road and odd # numbers allotted on the West or North side of the road. # d. Origin for numbers: # 9 (1) The origin for numbers progressing from West to # East shall be in a line extending along the West side of the # second section West Of the Range Line common to Ranges # and 12 West, San Bernardino Base and Meridian. # (2) The origin for numbers progressing from North to # South shall be in the Township Line common to Townships 2 # and 3 South, San Bernardino Base and Meridian (North # boundary line of Orange County. # numbering system for District No. 2 shall be as follows: # C. Numbers allotted to property fronting on a road shall # progress from Northwest to Southeast or from Northeast to # Southwest, with even numbers allotted on the Southeast or # Southwest side of the road and odd numbers allotted on the # Northwest or Northeast side of the road. # (1) The origin for numbers progressing for Northwest # to Southeast shall be the Northwesterly boundary line of # Irvine's Subdivision - the first block (or mile) having # numbers in the bracket from 1001 to 1999- # (2) The origin for numbers progressing from Northeast # to Southwest shall be the Northeasterly line of Block 32 of # Irvine's Subdivision - Block 32 having numbers in the # bracket from 1001 to 1999... # https://commons.wikimedia.org/wiki/File:Irvine%27s_Subdivision_map,_1899.jpg # https://unix.stackexchange.com/a/804876/179494 empty := space := $(empty) $(empty) $(space) :=