From 3b745f706c3d229cbe6b9123000ddb7eb83545c4 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 20 Nov 2026 12:22:58 -0700 Subject: [PATCH] Place the Mogollon Rim Trail in the White Mountains of Arizona, and refuse a place that lies in none of a trail's states or provinces A new registry range, white-mountains-arizona, shown as White Mountains, in Arizona. The validator now fails a record whose place's where shares no state or province with the record's regions, and place_trails.py no longer places a trail in a place outside its regions. The rule also caught the Hot Springs Trail (Nevada missing from its regions) and the North Boundary Trail (British Columbia missing), which now list those regions, and the Sentier international des Appalaches, whose track carries the Maine IAT into Katahdin Woods and Waters: that placement is removed. Co-Authored-By: Claude Sonnet 5.5 --- README.md | 4 +-- hot-springs-trail/trail.toml | 11 +++++++- mogollon-rim-trail/trail.toml | 2 +- north-boundary/trail.toml | 11 +++++++- places.toml | 10 +++++++ sentier-international-appalaches/trail.toml | 15 ---------- tools/check_places.py | 7 +++++ tools/place_allowlist.toml | 8 ++++++ tools/place_trails.py | 31 ++++++++++++++++++--- tools/tests/test_place_trails.py | 18 ++++++++++++ tools/tests/test_places.py | 16 +++++++++++ trails.csv | 4 +-- 12 files changed, 111 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index cd8f00b..005871f 100644 --- a/README.md +++ b/README.md @@ -130,7 +130,7 @@ A trail may be listed with no track included, when no track for it may be shared | mountains-to-sea | Mountains-to-Sea Trail | US | NC | 1890 | yes | ODbL-1.0 | | nepisiguit-migmaq-trail | Sentier Nepisiguit Mi'gmaq Trail | CA | NB | 150 | yes | ODbL-1.0 | | new-england | New England National Scenic Trail | US | CT, MA | 378 | yes | us-gov-public-domain | -| north-boundary | North Boundary Trail | CA | AB | 159 | no | none-stated | +| north-boundary | North Boundary Trail | CA | AB, BC | 159 | no | none-stated | | north-country | North Country National Scenic Trail | US | ND, MN, WI, MI, OH, PA, NY, VT | 7403 | yes | ODbL-1.0 | | north-south | North-South Trail | US | RI | 125 | yes | ODbL-1.0 | | north-south-lbl | North/South Trail (Land Between the Lakes) | US | KY, TN | 95 | yes | ODbL-1.0 | @@ -235,7 +235,7 @@ A route is a trail that a hiker worked out and published. The record names the a | green-river-lakes-titcomb-basin-loop | Green River Lakes & Titcomb Basin Loop | US | WY | 114 | Douglas Lorain | sold | no | [Backpacking Wyoming: From Towering Granite Peaks to Steaming Geyser Basins](https://shop.adventurewithkeen.com/product/backpacking-wyoming/) (purchase) | | hayduke-trail | Hayduke Trail | US | UT, AZ | 1287 | Joe Mitchell and Mike Coronella | sold | no | [The Hayduke Trail: A Guide to the Backcountry Hiking Trail on the Colorado Plateau](https://uofupress.com/books/the-hayduke-trail/) (purchase) | | heart-lake-two-ocean-plateau-loop | Heart Lake & Two Ocean Plateau Loop | US | WY | 99 | Douglas Lorain | sold | no | [Backpacking Wyoming: From Towering Granite Peaks to Steaming Geyser Basins](https://shop.adventurewithkeen.com/product/backpacking-wyoming/) (purchase) | -| hot-springs-trail | Hot Springs Trail | US | CA, OR, ID | 3896 | Aria Zoner | sold | no | [The Hot Springs Trail: Official Guidebook](https://www.amazon.com/Hot-Springs-Trail-Official-Guidebook/dp/1505613922) (purchase) | +| hot-springs-trail | Hot Springs Trail | US | CA, NV, OR, ID | 3896 | Aria Zoner | sold | no | [The Hot Springs Trail: Official Guidebook](https://www.amazon.com/Hot-Springs-Trail-Official-Guidebook/dp/1505613922) (purchase) | | kanab-canyon-loop | Kanab Canyon Loop | US | AZ | 84 | Bruce Grubbs | sold | no | [Backpacking Arizona: From Deep Canyons to Sky Islands](https://shop.adventurewithkeen.com/product/backpacking-arizona/) (purchase) | | kings-canyon-high-basin-route | Kings Canyon High Basin Route | US | CA | 200 | Andrew Skurka | sold | no | [Kings Canyon High Basin Route Guide](https://andrewskurka.com/product/kings-canyon-high-basin-route-guide/) (purchase) | | lowest-to-highest-route | Lowest to Highest Route | US | CA | 209 | Brett Tucker ("Blisterfree") and partner, simBLISSity Ultralight Designs | open | no | [L2H Navigation Bundle](http://simblissity.net/L2H.shtml) (free) | diff --git a/hot-springs-trail/trail.toml b/hot-springs-trail/trail.toml index 0ff16ea..859ba5a 100644 --- a/hot-springs-trail/trail.toml +++ b/hot-springs-trail/trail.toml @@ -5,7 +5,7 @@ name = "Hot Springs Trail" short_name = "HST" short_name_url = "https://outsideways.com/routes/us/hot-springs-trail/" country = "US" -regions = ["CA", "OR", "ID"] +regions = ["CA", "NV", "OR", "ID"] length_km = 3896 length_note = "2,421 mi, per the route page" kind = "route" @@ -154,3 +154,12 @@ basis = "The page says: \"These are undoubtedly some of the most striking miles basis_url = "https://outsideways.com/routes/us/hot-springs-trail/" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "Nevada is now listed among the states the route passes through, because the route page names its stretches in the Ruby Mountains, the East Humboldt Wilderness and the Jarbidge Wilderness, all in Nevada." +fields = ["regions"] +basis = "The route page says: \"These are undoubtedly some of the most striking miles of the trail as they overlook the Ruby Lakes basin and the Ruby Mountains, which are traversed during the next section.\" and \"the trail follows singletrack into the East Humboldt Wilderness.\"" +basis_url = "https://outsideways.com/routes/us/hot-springs-trail/" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/mogollon-rim-trail/trail.toml b/mogollon-rim-trail/trail.toml index 4fbc788..6bc3813 100644 --- a/mogollon-rim-trail/trail.toml +++ b/mogollon-rim-trail/trail.toml @@ -119,7 +119,7 @@ source = "https://blisterfree.wordpress.com/2019/02/24/introducing-the-mogollon- [[place]] kind = "range" -slug = "white-mountains" +slug = "white-mountains-arizona" basis = "stated" source = "https://blisterfree.wordpress.com/2019/02/24/introducing-the-mogollon-rim-trail/" diff --git a/north-boundary/trail.toml b/north-boundary/trail.toml index e51b4bd..d55d3af 100644 --- a/north-boundary/trail.toml +++ b/north-boundary/trail.toml @@ -3,7 +3,7 @@ id = "north-boundary" name = "North Boundary Trail" country = "CA" -regions = ["AB"] +regions = ["AB", "BC"] length_km = 159 length_note = "159 km one way, from the Jasper National Park page" tier = "regional" @@ -142,3 +142,12 @@ basis = "The page says: \"At the first junction, follow the trail to Willow Cree basis_url = "https://parks.canada.ca/pn-np/ab/jasper/activ/passez-stay/arrierepays-backcountry/sugg-sentiers_trip-ideas/north-boundary" asked_by = "the dataset's own check" outcome = "applied" + +[[history]] +date = "2026-11-20" +change = "British Columbia is now listed with Alberta as a state or province the trail passes through, because the trail ends in Mount Robson Provincial Park." +fields = ["regions"] +basis = "The record's own end point is the Berg Lake trailhead in Mount Robson Provincial Park, British Columbia, and the Parks Canada page says Snake Indian Pass marks the boundary between Jasper National Park and Mt. Robson Provincial Park." +basis_url = "https://parks.canada.ca/pn-np/ab/jasper/activ/passez-stay/arrierepays-backcountry/sugg-sentiers_trip-ideas/north-boundary" +asked_by = "the dataset's own check" +outcome = "applied" diff --git a/places.toml b/places.toml index 49ef5a0..0079aaf 100644 --- a/places.toml +++ b/places.toml @@ -1513,6 +1513,16 @@ source_id = "12331" source_version = "2026-11-20" box = [-72.12, 43.75, -70.79, 45.04] +[[place]] +slug = "white-mountains-arizona" +kind = "range" +name = "White Mountains" +where = ["AZ"] +source = "gmba-v2" +source_id = "16575" +source_version = "2026-11-20" +box = [-110.26, 32.96, -108.92, 34.29] + [[place]] slug = "wind-river-range" kind = "range" diff --git a/sentier-international-appalaches/trail.toml b/sentier-international-appalaches/trail.toml index a68823b..a9d85b1 100644 --- a/sentier-international-appalaches/trail.toml +++ b/sentier-international-appalaches/trail.toml @@ -97,12 +97,6 @@ slug = "gaspesie-national-park" basis = "track" km = 102.4 -[[place]] -kind = "park" -slug = "katahdin-woods-and-waters-national-monument" -basis = "track" -km = 46.7 - [[place]] kind = "park" slug = "mount-carleton-provincial-park" @@ -169,12 +163,3 @@ basis = "Measured from the trail's main track against the Environment and Climat basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c" asked_by = "the dataset's own check" outcome = "applied" - -[[history]] -date = "2026-11-20" -change = "The trail was placed in Katahdin Woods and Waters National Monument." -fields = ["place"] -basis = "Measured from the trail's main track against the Environment and Climate Change Canada, CPCAD outlines (cpcad, 2026-11-20), the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-11-20), the National Park Service, Land Resources Division outlines (nps, 2026-11-20) by tools/place_trails.py." -basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c" -asked_by = "the dataset's own check" -outcome = "applied" diff --git a/tools/check_places.py b/tools/check_places.py index 827969c..491eacc 100644 --- a/tools/check_places.py +++ b/tools/check_places.py @@ -151,6 +151,13 @@ def check_record(tid, rec, tdir, registry, errors): errors.append(f"{where} slug must be a non-empty string") elif kind in KINDS and (kind, slug) not in registry: errors.append(f"{where} {kind}/{slug} is not in places.toml") + if kind in KINDS and (kind, slug) in registry: + lies = [str(c) for c in registry[(kind, slug)].get("where") or []] + regions = [str(c) for c in rec.get("regions") or []] + if lies and regions and not set(lies) & set(regions): + errors.append(f"{where} {kind}/{slug} lies in {', '.join(lies)}, none of the " + f"record's regions ({', '.join(regions)}); a place must lie in at " + f"least one of the trail's states or provinces") if (kind, slug) in seen: errors.append(f"{where} lists {kind}/{slug} more than once; a place is listed once per record") seen.add((kind, slug)) diff --git a/tools/place_allowlist.toml b/tools/place_allowlist.toml index 865a65f..c052777 100644 --- a/tools/place_allowlist.toml +++ b/tools/place_allowlist.toml @@ -262,6 +262,14 @@ name = "White Mountains" within = ["appalachian-mountains"] where = ["ME", "NH"] +# The White Mountains of Arizona (GMBA 16575), not the ones of New Hampshire and Maine above. +# The display name is the same; the slug says which. +[[range]] +gmba_id = "16575" +slug = "white-mountains-arizona" +name = "White Mountains" +where = ["AZ"] + [[range]] gmba_id = "11169" slug = "bighorn-mountains" diff --git a/tools/place_trails.py b/tools/place_trails.py index f9529eb..9eafe86 100644 --- a/tools/place_trails.py +++ b/tools/place_trails.py @@ -536,7 +536,9 @@ def merge_same_name(outlines): place carries every id. The source lists some ranges twice under different ids.""" merged, order = {}, [] for o in outlines: - key = (o.kind, o.source, " ".join(o.name.lower().split())) + # An explicit slug tells two ranges of one display name apart (the White Mountains + # of New Hampshire and of Arizona); the two Palisades ids share a slug and merge. + key = (o.kind, o.source, " ".join(o.name.lower().split()), o.slug or "") # Two wilderness areas or parks of one name in different places are two places # (assign_slugs tells them apart by state); a range is one wherever its pieces lie. if key in merged and o.kind != "range" and not any( @@ -686,7 +688,24 @@ def _measure(records, outlines): return hits -def propose(records, outlines): +def propose(records, outlines, reviewed_where=None): + """Measure every track against every outline. A place counts for a trail only when it + lies in at least one of the trail's states or provinces (the validator's rule): a track + that strays over a border, or a relation that carries a neighbour's section, does not + place the trail in the neighbour's park. reviewed_where is the registry's reviewed + `where` by (kind, slug); it wins over the outline's own.""" + reviewed_where = reviewed_where or {} + lies_cache = {} + + def lies(idx, regions): + if not regions: + return True + if idx not in lies_cache: + o = outlines[idx] + lies_cache[idx] = set(reviewed_where.get((o.kind, o.slug or slugify(o.name))) + or where_of(o)) + return not lies_cache[idx] or bool(lies_cache[idx] & set(regions)) + p = Proposal(names={r["id"]: r.get("name") or r["id"] for r in records}) p.no_track = [r["id"] for r in records if r.get("track") is None] for r in records: @@ -696,6 +715,8 @@ def propose(records, outlines): for (tid, idx), (km, clipped) in sorted(hits.items()): o = outlines[idx] key = (o.kind, o.slug or slugify(o.name)) + if not lies(idx, by_id[tid].get("regions")): + continue if abs(km - MIN_KM) <= 0.5: p.near.append(NearItem(tid, key, km, clipped)) if km < MIN_KM: @@ -1149,7 +1170,8 @@ def check(root, cache, outlines=None, versions=None, records=None): versions = source_versions(cache) if records is None: records = load_records(root) - p = propose(records, outlines) + p = propose(records, outlines, {(e.get("kind"), e.get("slug")): e.get("where") + for e in registry_entries(root)}) diffs = [] current_counts = {} for r in records: @@ -1246,7 +1268,8 @@ def main(argv=None): allow = load_allowlist(_opt(argv, "--allowlist", default_allowlist_path())) outlines = catalogue(cache_dir(), allow) records = load_records() - p = propose(records, outlines) + p = propose(records, outlines, {(e.get("kind"), e.get("slug")): e.get("where") + for e in registry_entries(ROOT)}) p.versions = source_versions(cache_dir()) dest = os.path.join(_out_dir(_opt(argv, "--out")), "proposal.md") render_proposal(p, dest) diff --git a/tools/tests/test_place_trails.py b/tools/tests/test_place_trails.py index 3f0855e..207d50f 100644 --- a/tools/tests/test_place_trails.py +++ b/tools/tests/test_place_trails.py @@ -111,6 +111,17 @@ class ProposalTest(unittest.TestCase): self.park_only = LineString([(-109.9, 43.2), (-109.9, 43.29)]) self.outside = LineString([(-107.0, 43.2), (-107.0, 43.29)]) + def test_a_place_outside_the_trails_regions_does_not_place_it(self): + p = P.propose([rec("a", ["NH"], self.inside)], [self.park, self.range]) + self.assertEqual(p.per_trail["a"], []) + p = P.propose([rec("a", ["NH", "WY"], self.inside)], [self.park, self.range]) + self.assertEqual({k for k, _km in p.per_trail["a"]}, {("park", "alpha-park"), ("range", "beta-range")}) + + def test_the_registrys_reviewed_where_wins(self): + p = P.propose([rec("a", ["NH"], self.inside)], [self.park], + {("park", "alpha-park"): ["NH"]}) + self.assertEqual([k for k, _km in p.per_trail["a"]], [("park", "alpha-park")]) + def test_propose_lists_per_trail_places_and_per_place_trails(self): records = [rec("a", ["WY"], self.inside), rec("b", ["WY"], self.park_only), rec("c", ["WY"], self.inside)] @@ -189,6 +200,13 @@ class ProposalTest(unittest.TestCase): out = P.assign_slugs(out) self.assertEqual(out[0].slug, "palisades") # no numeric suffix, no state code + def test_two_ranges_of_one_display_name_with_different_slugs_stay_two_places(self): + a = outline("range", "12331", "White Mountains", self.park.geometry, slug="white-mountains") + b = outline("range", "16575", "White Mountains", self.range.geometry, + slug="white-mountains-arizona") + self.assertEqual([o.slug for o in P.merge_same_name([a, b])], + ["white-mountains", "white-mountains-arizona"]) + def test_the_same_name_from_two_sources_or_kinds_is_not_merged(self): a = outline("park", "1", "Glacier", self.park.geometry, hint=["MT"]) b = outline("park", "2", "Glacier", self.range.geometry, hint=["BC"]) diff --git a/tools/tests/test_places.py b/tools/tests/test_places.py index 513970f..90964af 100644 --- a/tools/tests/test_places.py +++ b/tools/tests/test_places.py @@ -183,3 +183,19 @@ class WholeRepoTest(unittest.TestCase): if __name__ == "__main__": unittest.main() + + +class PlaceLiesInTheTrailsRegionsTest(unittest.TestCase): + def stated(self, **kw): + return record(regions=kw.pop("regions"), places_checked="2026-11-20", + place=[{"kind": "range", "slug": "wind-river-range", "basis": "stated", + "source": "https://example.org/x"}]) + + def test_a_place_in_one_of_the_trails_states_passes(self): + errs = record_errors(self.stated(regions=["ID", "WY"])) + self.assertEqual([e for e in errs if "lies in" in e], []) + + def test_a_place_in_none_of_the_trails_states_fails(self): + errs = record_errors(self.stated(regions=["AZ", "NM"])) + self.assertTrue(any("range/wind-river-range lies in WY, none of the record's regions (AZ, NM)" in e + for e in errs), errs) diff --git a/trails.csv b/trails.csv index 524bbf3..e270fdc 100644 --- a/trails.csv +++ b/trails.csv @@ -93,7 +93,7 @@ highlands,Highlands Trail,US,NJ;NY;PA;CT,290,included,OpenStreetMap,ODbL-1.0,des highline,Highline National Recreation Trail,US,AZ,89,included,OpenStreetMap,ODbL-1.0,designated, hoosier-heritage-trail,Hoosier Heritage Trail,US,IN,259,included,Hoosier Heritage Trail Association (the holder's GPX file),stated-permission,designated, horse-shoe,Horse-Shoe Trail,US,PA,225,included,OpenStreetMap,ODbL-1.0,designated, -hot-springs-trail,Hot Springs Trail,US,CA;OR;ID,3896,record-only,none (no line included),none-stated,route,sold +hot-springs-trail,Hot Springs Trail,US,CA;NV;OR;ID,3896,record-only,none (no line included),none-stated,route,sold iat-newfoundland-labrador,"International Appalachian Trail, Newfoundland and Labrador",CA,NL,750,included,OpenStreetMap,ODbL-1.0,designated, ice-age,Ice Age National Scenic Trail,US,WI,1931,included,OpenStreetMap,ODbL-1.0,designated, idaho-centennial,Idaho Centennial Trail,US,ID,1448,included,OpenStreetMap,ODbL-1.0,designated, @@ -133,7 +133,7 @@ mountains-to-sea,Mountains-to-Sea Trail,US,NC,1890,included,OpenStreetMap,ODbL-1 nankoweap-bright-angel-loop,Nankoweap–Bright Angel Loop,US,AZ,132,record-only,none (no line included),none-stated,route,sold nepisiguit-migmaq-trail,Sentier Nepisiguit Mi'gmaq Trail,CA,NB,150,included,OpenStreetMap,ODbL-1.0,designated, new-england,New England National Scenic Trail,US,CT;MA,378,included,National Park Service with the Connecticut Forest & Park Association and the Appalachian Mountain Club,us-gov-public-domain,designated, -north-boundary,North Boundary Trail,CA,AB,159,record-only,none (no line included),none-stated,designated, +north-boundary,North Boundary Trail,CA,AB;BC,159,record-only,none (no line included),none-stated,designated, north-country,North Country National Scenic Trail,US,ND;MN;WI;MI;OH;PA;NY;VT,7403,included,OpenStreetMap,ODbL-1.0,designated, north-south,North-South Trail,US,RI,125,included,OpenStreetMap,ODbL-1.0,designated, north-south-lbl,North/South Trail (Land Between the Lakes),US,KY;TN,95,included,OpenStreetMap,ODbL-1.0,designated,