diff --git a/README.md b/README.md index e1c29dd..bfd609c 100644 --- a/README.md +++ b/README.md @@ -236,7 +236,7 @@ consistent draw of them, which the locale's `address` reads. |-------|----------|----------|--------| | `region` | län, by code or name | state, by USPS abbreviation or name; `code` is the FIPS code | population | | `municipality` | kommun, by code or name | county, by FIPS code or name | population | -| `locality` | postort, by name | incorporated place of 25,000 people or more, by GEOID or name; Hawaii has none | tätort population, the kommun's where the postort names it, else 200; place population | +| `locality` | postort, by name | incorporated place of 25,000 people or more with a postal code of its own, by GEOID or name; Hawaii has none | tätort population, the kommun's where the postort names it, else 200; place population | | `postal-code` | postnummer with street delivery, by code | ZCTA, by code | one; address ranges | | `street` | gatunamn, the ten with most road segments per postort | street name, the ten with most address ranges per place | segments; address ranges | @@ -1035,9 +1035,11 @@ renamed or retyped line is a major. holding most of its land inside places.** `I- 55 Bus` and `US Hwy 1` carry the most address ranges in many places and would head every address, so the import drops names spelled as a route. A ZCTA goes to the place its largest in-place part - lies in, and ships only when that place does; counting the land outside every - place too would drop a quarter of the places, whose codes straddle unincorporated - land, for a postal city the USPS mostly names the same way. + lies in, census-designated places left out since they never ship, and ships only + when that place does, so a few dozen places whose every code lies mostly in a + bigger neighbour ship no address; counting the land outside every place too would + drop a quarter of the places, whose codes straddle unincorporated land, for a + postal city the USPS mostly names the same way. - **`List` advertises direct descents only.** `region.municipality.locality` is listed, and `region.locality` resolves too but is not: the set of every descent through a chain of five tables is every subsequence of it, and the direct chain is diff --git a/data-import/geo-us.py b/data-import/geo-us.py index 425510f..9631d48 100644 --- a/data-import/geo-us.py +++ b/data-import/geo-us.py @@ -27,7 +27,7 @@ OUT = Path(__file__).resolve().parent.parent / "data" / "geo" / "US" CACHE = Path(__file__).resolve().parent / "cache" ESTIMATE = "POPESTIMATE2025" CDP = "57" -HIGHWAY = re.compile(r"\b(I- |Hwy |Rte |Route |Rd )\d") +HIGHWAY = re.compile(r"\b(I- |Hwy |Highway |Loop |Rte |Route |Rd )\d") SUFFIX = re.compile(r" (city and borough|city|town|village|borough|municipality|comunidad|zona urbana|metropolitan government|metro government|consolidated government|unified government|urban county|corporation|plantation)( \(balance\))?$") # Places whose Census name is a merged government's; the postal city is what an address carries. NAMES = {"1303440": "Athens", "1304204": "Augusta", "1349008": "Macon", "2148006": "Louisville", "3011397": "Butte", "4732742": "Hartsville", "4752006": "Nashville"} @@ -128,10 +128,10 @@ def localities(cache, min_population, counties): def postal_codes(cache, localities): - """Each ZCTA whose largest part inside any place lies in a shipped place.""" + """Each ZCTA whose largest part inside an incorporated place lies in a shipped place.""" parts = {} for r in csv.DictReader(io.StringIO(text(tsv.fetch(ZCTA_PLACE, cache, "zcta-place.txt"))), delimiter="|"): - if r["GEOID_ZCTA5_20"] and r["GEOID_PLACE_20"]: + if r["GEOID_ZCTA5_20"] and r["GEOID_PLACE_20"] and not r["NAMELSAD_PLACE_20"].endswith(" CDP"): parts.setdefault(r["GEOID_ZCTA5_20"], []).append((int(r["AREALAND_PART"]), r["GEOID_PLACE_20"])) largest = {zcta: max(p)[1] for zcta, p in parts.items()} return {zcta: place for zcta, place in largest.items() if place in localities} diff --git a/todo.md b/todo.md index 2671fe0..617811f 100644 --- a/todo.md +++ b/todo.md @@ -54,10 +54,10 @@ countries; the README maps each to the native term. | Table | SE | US | Weight | |---|---|---|---| | `region` | län (21) | state and DC (50; Hawaii has no incorporated place) | population | -| `municipality` | kommun (290) | county with a shipped place (663) | population | -| `locality` | postort (1,522), tätort population | place of 25,000+ (1,579) | population | -| `postal-code` | postnummer with street delivery (13,712) | ZCTA of a shipped place (5,946) | one; address ranges | -| `street` | gatunamn, top 10 per postort (14,764) | street name, top 10 per place (15,790) | segments; address ranges | +| `municipality` | kommun (290) | county with a shipped place | population | +| `locality` | postort, tätort population | place of 25,000+ | population | +| `postal-code` | postnummer with street delivery | ZCTA of a shipped place | one; address ranges | +| `street` | gatunamn, top 10 per postort | street name, top 10 per place | segments; address ranges | - Shipped in step 2, README Data. `geo.SE.address` is a record over one consistent draw. Each region row carries its timezone, each locality its centroid.