Make the monthly place check compare like with like, fail loudly on a bad outline download, and bring twelve placements up to date
The 2026-12-01 run reported 440 differences, but the outlines had not changed: a fresh download on 2026-12-03 matched the 2026-11-20 files byte for byte. The check counted every new download date as a difference, counted stated placements of trails with no track before but not after (so Zion, Arches and others read as "down to 0 trails"), and let the Montana and British Columbia Glacier parks push each other to suffixed slugs. A download date alone is no longer a difference; both sides of the 3-trail line count stated placements; Glacier National Park, Montana keeps the plain slug. An ArcGIS download now asks the service for its count and must bring exactly that many features, a service error body is raised, a source that yields no outlines is an error, and a registered place whose outline is gone stops the check naming it (exit 3), never "0 trails". The twelve real differences left are applied: ten trails gain a place the tool measures (Sheltowee Trace in Big South Fork; nine trails in the parent range left when a child range was dropped on 2026-11-20), and two wilderness twins of a same-named park are taken off the Brooks Range Traverse and the Guadalupe Ridge Trail and out of places.toml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
05284f87a1
commit
41019c81e1
16 files changed
+402
-78
No files matched your search
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-12-03 - Places brought up to date after the monthly check
|
||||||
|
|
||||||
|
- The Sheltowee Trace is now listed in Big South Fork National River and Recreation Area, which its track crosses for about 11.5 miles; the park was added on 2026-11-29 and the trail had not been measured against it.
|
||||||
|
- Nine trails now name the larger range they cross where a smaller range was taken off the site on 2026-11-20: the Appalachian Trail, the Benton MacKaye Trail and the Mountains-to-Sea Trail are in the Blue Ridge Mountains; the Bristol Hills Trail, the Finger Lakes Trail and the North Country Trail are on the Allegheny Plateau; the High Sierra Trail and the Rae Lakes Loop are in the Sierra Nevada; and the Sentier international des Appalaches is in the Appalachian Mountains.
|
||||||
|
- The Brooks Range Traverse no longer names Gates of the Arctic Wilderness, and the Guadalupe Ridge Trail no longer names Carlsbad Caverns Wilderness: each holds exactly the trails of the national park of the same name, which stays listed.
|
||||||
|
- The monthly place check now stops with an error naming the source when an outline download fails, comes back empty or comes back short, instead of reporting the trails as in no place.
|
||||||
|
|
||||||
## 2026-12-03 - Theodore Solomons Trail listed, and removed from the left-out list
|
## 2026-12-03 - Theodore Solomons Trail listed, and removed from the left-out list
|
||||||
|
|
||||||
- The Theodore Solomons Trail, a guidebook route in California's Sierra Nevada from Glacier Point in Yosemite to Horseshoe Meadow, is new at 271.3 miles, the figure SoCal Hiker gives from the route's guidebook. Dennis R. Gagnon developed it in 1974 as a lower elevation alternative to the John Muir Trail.
|
- The Theodore Solomons Trail, a guidebook route in California's Sierra Nevada from Glacier Point in Yosemite to Horseshoe Meadow, is new at 271.3 miles, the figure SoCal Hiker gives from the route's guidebook. Dennis R. Gagnon developed it in 1974 as a lower elevation alternative to the John Muir Trail.
|
||||||
|
|||||||
+16
-1
@@ -13,7 +13,7 @@ tier = "national"
|
|||||||
designation = "National Scenic Trail (1968)"
|
designation = "National Scenic Trail (1968)"
|
||||||
wave = 1
|
wave = 1
|
||||||
inclusion = "nst-unconditional"
|
inclusion = "nst-unconditional"
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "9ce3582335395f9c"
|
places_track = "9ce3582335395f9c"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -118,6 +118,12 @@ slug = "shenandoah-national-park"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 156.9
|
km = 156.9
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "blue-ridge-mountains"
|
||||||
|
basis = "track"
|
||||||
|
km = 1329.6
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "range"
|
kind = "range"
|
||||||
slug = "green-mountains"
|
slug = "green-mountains"
|
||||||
@@ -334,3 +340,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
|
|||||||
basis_url = "https://www.earthenv.org/mountains"
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Blue Ridge Mountains."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03), the National Park Service, Land Resources Division outlines (nps, 2026-12-03), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -11,7 +11,7 @@ length_note = "288 mi"
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "Benton MacKaye Trail Association"
|
designation = "Benton MacKaye Trail Association"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "ae87475de83cda4f"
|
places_track = "ae87475de83cda4f"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -96,6 +96,12 @@ slug = "great-smoky-mountains-national-park"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 147.1
|
km = 147.1
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "blue-ridge-mountains"
|
||||||
|
basis = "track"
|
||||||
|
km = 398.2
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
slug = "big-frog-wilderness"
|
slug = "big-frog-wilderness"
|
||||||
@@ -162,3 +168,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
|
|||||||
basis_url = "https://www.earthenv.org/mountains"
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Blue Ridge Mountains."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03), the National Park Service, Land Resources Division outlines (nps, 2026-12-03), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -9,7 +9,7 @@ length_note = "roughly 55 mi, per Go Finger Lakes; CNY Hiking says over 50 mi"
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "A branch trail of the Finger Lakes Trail, as CNY Hiking and Go Finger Lakes describe it"
|
designation = "A branch trail of the Finger Lakes Trail, as CNY Hiking and Go Finger Lakes describe it"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "69f6a84ced259132"
|
places_track = "69f6a84ced259132"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -78,6 +78,12 @@ url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
|||||||
publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)"
|
publisher = "WSL (CHELSA) and NOAA NCEI (ETOPO)"
|
||||||
facts = ["season", "months"]
|
facts = ["season", "months"]
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "allegheny-plateau"
|
||||||
|
basis = "track"
|
||||||
|
km = 33.2
|
||||||
|
|
||||||
# History of this record, oldest first. Add to it; never rewrite it.
|
# History of this record, oldest first. Add to it; never rewrite it.
|
||||||
# See docs/schema.md, section [[history]].
|
# See docs/schema.md, section [[history]].
|
||||||
|
|
||||||
@@ -107,3 +113,12 @@ basis = "No page states a season. It was set by judgement from the climate at th
|
|||||||
basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Allegheny Plateau."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -115,12 +115,6 @@ slug = "brooks-range"
|
|||||||
basis = "stated"
|
basis = "stated"
|
||||||
source = "https://thingstolucat.com/brooks-range-traverse/"
|
source = "https://thingstolucat.com/brooks-range-traverse/"
|
||||||
|
|
||||||
[[place]]
|
|
||||||
kind = "wilderness"
|
|
||||||
slug = "gates-of-the-arctic-wilderness"
|
|
||||||
basis = "stated"
|
|
||||||
source = "https://thingstolucat.com/gates-of-the-arctic-traverse/"
|
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
slug = "mollie-beattie-wilderness"
|
slug = "mollie-beattie-wilderness"
|
||||||
@@ -178,3 +172,12 @@ basis = "No page states a season. It was set by judgement from the climate at th
|
|||||||
basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was taken out of Gates of the Arctic Wilderness, a twin of Gates of the Arctic National Park and Preserve: it holds exactly the park's trails and shares its name, so the park is listed alone."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "The monthly place check found Gates of the Arctic Wilderness a twin of Gates of the Arctic National Park and Preserve: the same trails and the same name. The place tool lists the park only."
|
||||||
|
basis_url = "https://thingstolucat.com/gates-of-the-arctic-traverse/"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
+16
-1
@@ -11,7 +11,7 @@ length_note = "580 mi for the main trail, as the Finger Lakes Trail Conference's
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "Finger Lakes Trail Conference; the North Country NST follows it in NY"
|
designation = "Finger Lakes Trail Conference; the North Country NST follows it in NY"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "3a0988d427c947da"
|
places_track = "3a0988d427c947da"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -81,6 +81,12 @@ title = "Finger Lakes Trail"
|
|||||||
publisher = "LongTrailsWiki"
|
publisher = "LongTrailsWiki"
|
||||||
url = "https://www.longtrailswiki.net/wiki/Finger_Lakes_Trail"
|
url = "https://www.longtrailswiki.net/wiki/Finger_Lakes_Trail"
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "allegheny-plateau"
|
||||||
|
basis = "track"
|
||||||
|
km = 8.4
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "range"
|
kind = "range"
|
||||||
slug = "catskill-mountains"
|
slug = "catskill-mountains"
|
||||||
@@ -124,3 +130,12 @@ basis = "No page states a season: the one page found contradicts itself. It was
|
|||||||
basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
basis_url = "https://www.chelsa-climate.org/datasets/chelsa_climatologies"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Allegheny Plateau."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -104,12 +104,6 @@ slug = "guadalupe-mountains-national-park"
|
|||||||
basis = "stated"
|
basis = "stated"
|
||||||
source = "https://www.nps.gov/thingstodo/grt.htm"
|
source = "https://www.nps.gov/thingstodo/grt.htm"
|
||||||
|
|
||||||
[[place]]
|
|
||||||
kind = "wilderness"
|
|
||||||
slug = "carlsbad-caverns-wilderness"
|
|
||||||
basis = "stated"
|
|
||||||
source = "https://www.nps.gov/thingstodo/grt.htm"
|
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
slug = "guadalupe-mountains-wilderness"
|
slug = "guadalupe-mountains-wilderness"
|
||||||
@@ -153,3 +147,12 @@ basis = "The page says: \"Over 20 miles (32 km) of the GRT is within Carlsbad Ca
|
|||||||
basis_url = "https://www.nps.gov/thingstodo/grt.htm"
|
basis_url = "https://www.nps.gov/thingstodo/grt.htm"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was taken out of Carlsbad Caverns Wilderness, a twin of Carlsbad Caverns National Park: it holds exactly the park's trails and shares its name, so the park is listed alone."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "The monthly place check found Carlsbad Caverns Wilderness a twin of Carlsbad Caverns National Park: the same trails and the same name. The place tool lists the park only."
|
||||||
|
basis_url = "https://www.nps.gov/thingstodo/grt.htm"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
+16
-1
@@ -11,7 +11,7 @@ length_note = "72.2 mi (115.5 km) from Crescent Meadow to Whitney Portal, as the
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "National Park Service, Sequoia and Kings Canyon National Parks"
|
designation = "National Park Service, Sequoia and Kings Canyon National Parks"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "757c4bb8c5b16e61"
|
places_track = "757c4bb8c5b16e61"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -96,6 +96,12 @@ slug = "sequoia-and-kings-canyon-national-parks"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 92.9
|
km = 92.9
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "sierra-nevada"
|
||||||
|
basis = "track"
|
||||||
|
km = 105.7
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
slug = "john-muir-wilderness"
|
slug = "john-muir-wilderness"
|
||||||
@@ -156,3 +162,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
|
|||||||
basis_url = "https://www.earthenv.org/mountains"
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Sierra Nevada."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03), the National Park Service, Land Resources Division outlines (nps, 2026-12-03), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -11,7 +11,7 @@ length_note = "about 1,175 mi planned"
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "North Carolina State Trail; Friends of the Mountains-to-Sea Trail"
|
designation = "North Carolina State Trail; Friends of the Mountains-to-Sea Trail"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "7998ce6018fc36b9"
|
places_track = "7998ce6018fc36b9"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -101,6 +101,12 @@ slug = "great-smoky-mountains-national-park"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 45.5
|
km = 45.5
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "blue-ridge-mountains"
|
||||||
|
basis = "track"
|
||||||
|
km = 540.8
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
slug = "linville-gorge-wilderness"
|
slug = "linville-gorge-wilderness"
|
||||||
@@ -167,3 +173,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
|
|||||||
basis_url = "https://www.earthenv.org/mountains"
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Blue Ridge Mountains."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03), the National Park Service, Land Resources Division outlines (nps, 2026-12-03), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -11,7 +11,7 @@ tier = "national"
|
|||||||
designation = "National Scenic Trail (1980)"
|
designation = "National Scenic Trail (1980)"
|
||||||
wave = 1
|
wave = 1
|
||||||
inclusion = "nst-unconditional"
|
inclusion = "nst-unconditional"
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "591729ca16beee21"
|
places_track = "591729ca16beee21"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -101,6 +101,12 @@ slug = "adirondack-mountains"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 223.8
|
km = 223.8
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "allegheny-plateau"
|
||||||
|
basis = "track"
|
||||||
|
km = 8.4
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "range"
|
kind = "range"
|
||||||
slug = "green-mountains"
|
slug = "green-mountains"
|
||||||
@@ -189,3 +195,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
|
|||||||
basis_url = "https://www.earthenv.org/mountains"
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Allegheny Plateau."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
-20
@@ -1867,16 +1867,6 @@ source_id = "714"
|
|||||||
source_version = "2026-11-20"
|
source_version = "2026-11-20"
|
||||||
box = [-113.11, 37.0, -112.9, 37.14]
|
box = [-113.11, 37.0, -112.9, 37.14]
|
||||||
|
|
||||||
[[place]]
|
|
||||||
slug = "carlsbad-caverns-wilderness"
|
|
||||||
kind = "wilderness"
|
|
||||||
name = "Carlsbad Caverns Wilderness"
|
|
||||||
where = ["NM"]
|
|
||||||
source = "wilderness-connect"
|
|
||||||
source_id = "100"
|
|
||||||
source_version = "2026-11-20"
|
|
||||||
box = [-104.68, 32.04, -104.43, 32.2]
|
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
slug = "carson-iceberg-wilderness"
|
slug = "carson-iceberg-wilderness"
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
@@ -2207,16 +2197,6 @@ source_id = "198"
|
|||||||
source_version = "2026-11-20"
|
source_version = "2026-11-20"
|
||||||
box = [-88.43, 37.58, -88.37, 37.63]
|
box = [-88.43, 37.58, -88.37, 37.63]
|
||||||
|
|
||||||
[[place]]
|
|
||||||
slug = "gates-of-the-arctic-wilderness"
|
|
||||||
kind = "wilderness"
|
|
||||||
name = "Gates of the Arctic Wilderness"
|
|
||||||
where = ["AK"]
|
|
||||||
source = "wilderness-connect"
|
|
||||||
source_id = "199"
|
|
||||||
source_version = "2026-11-20"
|
|
||||||
box = [-157.0, 67.02, -149.77, 68.66]
|
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
slug = "gila-wilderness"
|
slug = "gila-wilderness"
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ tier = "short"
|
|||||||
designation = "National Park Service trails in Kings Canyon National Park, walked as a loop from Road's End and described as one on the Park Service's Rae Lakes Loop page"
|
designation = "National Park Service trails in Kings Canyon National Park, walked as a loop from Road's End and described as one on the Park Service's Rae Lakes Loop page"
|
||||||
wave = 1
|
wave = 1
|
||||||
short_reason = "Very well known and popular: the Park Service limits the number of people starting each day by entry point and takes reservations up to six months ahead."
|
short_reason = "Very well known and popular: the Park Service limits the number of people starting each day by entry point and takes reservations up to six months ahead."
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "45ce8347a4d34f01"
|
places_track = "45ce8347a4d34f01"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -97,6 +97,12 @@ slug = "sequoia-and-kings-canyon-national-parks"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 57.3
|
km = 57.3
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "sierra-nevada"
|
||||||
|
basis = "track"
|
||||||
|
km = 57.3
|
||||||
|
|
||||||
|
|
||||||
# History of this record, oldest first. Add to it; never rewrite it.
|
# History of this record, oldest first. Add to it; never rewrite it.
|
||||||
# See docs/schema.md, section [[history]].
|
# See docs/schema.md, section [[history]].
|
||||||
@@ -190,3 +196,12 @@ basis = "Measured from the trail's main track against the GMBA Mountain Inventor
|
|||||||
basis_url = "https://www.earthenv.org/mountains"
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Sierra Nevada."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03), the National Park Service, Land Resources Division outlines (nps, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://www.earthenv.org/mountains"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
@@ -11,7 +11,7 @@ length_note = "about 650 km in Quebec (SIA-QC) plus about 527 km in New Brunswic
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "Sentier international des Appalaches; International Appalachian Trail"
|
designation = "Sentier international des Appalaches; International Appalachian Trail"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "f35a1117bac0f058"
|
places_track = "f35a1117bac0f058"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -103,6 +103,12 @@ slug = "mount-carleton-provincial-park"
|
|||||||
basis = "track"
|
basis = "track"
|
||||||
km = 6.2
|
km = 6.2
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "range"
|
||||||
|
slug = "appalachian-mountains"
|
||||||
|
basis = "track"
|
||||||
|
km = 386.2
|
||||||
|
|
||||||
# History of this record, oldest first. Add to it; never rewrite it.
|
# History of this record, oldest first. Add to it; never rewrite it.
|
||||||
# See docs/schema.md, section [[history]].
|
# See docs/schema.md, section [[history]].
|
||||||
|
|
||||||
@@ -157,3 +163,12 @@ 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"
|
basis_url = "https://open.canada.ca/data/dataset/6c343726-1e92-451a-876a-76e17d398a1c"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Appalachian Mountains."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the Environment and Climate Change Canada, CPCAD outlines (cpcad, 2026-12-03), the GMBA Mountain Inventory v2 (Snethlage et al. 2022), via EarthEnv outlines (gmba-v2, 2026-12-03) 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"
|
||||||
@@ -10,7 +10,7 @@ length_note = "343 mi, the association's official distance in 2025: 'In 2025 the
|
|||||||
tier = "regional"
|
tier = "regional"
|
||||||
designation = "National Recreation Trail, Daniel Boone National Forest"
|
designation = "National Recreation Trail, Daniel Boone National Forest"
|
||||||
wave = 1
|
wave = 1
|
||||||
places_checked = "2026-11-20"
|
places_checked = "2026-12-03"
|
||||||
places_track = "b7efbe6a1852ed33"
|
places_track = "b7efbe6a1852ed33"
|
||||||
|
|
||||||
[source]
|
[source]
|
||||||
@@ -91,6 +91,12 @@ title = "Sheltowee Trace"
|
|||||||
publisher = "LongTrailsWiki"
|
publisher = "LongTrailsWiki"
|
||||||
url = "https://www.longtrailswiki.net/wiki/Sheltowee_Trace"
|
url = "https://www.longtrailswiki.net/wiki/Sheltowee_Trace"
|
||||||
|
|
||||||
|
[[place]]
|
||||||
|
kind = "park"
|
||||||
|
slug = "big-south-fork-national-river-and-recreation-area"
|
||||||
|
basis = "track"
|
||||||
|
km = 18.5
|
||||||
|
|
||||||
[[place]]
|
[[place]]
|
||||||
kind = "wilderness"
|
kind = "wilderness"
|
||||||
slug = "clifty-wilderness"
|
slug = "clifty-wilderness"
|
||||||
@@ -152,3 +158,12 @@ basis = "Measured from the trail's main track against the Wilderness Connect, Un
|
|||||||
basis_url = "https://wilderness.net/visit-wilderness/gis-gps.php"
|
basis_url = "https://wilderness.net/visit-wilderness/gis-gps.php"
|
||||||
asked_by = "the dataset's own check"
|
asked_by = "the dataset's own check"
|
||||||
outcome = "applied"
|
outcome = "applied"
|
||||||
|
|
||||||
|
[[history]]
|
||||||
|
date = "2026-12-03"
|
||||||
|
change = "The trail was placed in Big South Fork National River and Recreation Area."
|
||||||
|
fields = ["place"]
|
||||||
|
basis = "Measured from the trail's main track against the National Park Service, Land Resources Division outlines (nps, 2026-12-03), the Wilderness Connect, University of Montana (wilderness.net) outlines (wilderness-connect, 2026-12-03) by tools/place_trails.py."
|
||||||
|
basis_url = "https://irma.nps.gov/DataStore/Reference/Profile/2224545"
|
||||||
|
asked_by = "the dataset's own check"
|
||||||
|
outcome = "applied"
|
||||||
+115
-35
@@ -195,33 +195,68 @@ def cache_dir():
|
|||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
||||||
|
class SourceError(RuntimeError):
|
||||||
|
"""An outline source failed, came back empty, or came back short. The check stops on
|
||||||
|
this, naming the source: a missing outline must never read as a trail in no place."""
|
||||||
|
|
||||||
|
|
||||||
def _download(url, dest):
|
def _download(url, dest):
|
||||||
req = urllib.request.Request(url, headers={"User-Agent": "longhikes place_trails.py"})
|
req = urllib.request.Request(url, headers={"User-Agent": "longhikes place_trails.py"})
|
||||||
|
got = 0
|
||||||
with urllib.request.urlopen(req, timeout=600) as r, open(dest + ".part", "wb") as f:
|
with urllib.request.urlopen(req, timeout=600) as r, open(dest + ".part", "wb") as f:
|
||||||
|
want = r.headers.get("Content-Length")
|
||||||
while True:
|
while True:
|
||||||
chunk = r.read(1 << 20)
|
chunk = r.read(1 << 20)
|
||||||
if not chunk:
|
if not chunk:
|
||||||
break
|
break
|
||||||
|
got += len(chunk)
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
|
if got == 0 or (want and int(want) != got):
|
||||||
|
os.remove(dest + ".part")
|
||||||
|
raise SourceError(f"{url}: download came back with {got} bytes"
|
||||||
|
+ (f", not the {want} the server announced" if want else ""))
|
||||||
os.rename(dest + ".part", dest)
|
os.rename(dest + ".part", dest)
|
||||||
|
|
||||||
|
|
||||||
|
def _arcgis_get(query_url, params):
|
||||||
|
"""One ArcGIS query as JSON. ArcGIS answers some failures with HTTP 200 and an
|
||||||
|
{"error": ...} body; that is raised, not read as no features."""
|
||||||
|
url = query_url + "?" + urllib.parse.urlencode(params)
|
||||||
|
req = urllib.request.Request(url, headers={"User-Agent": "longhikes place_trails.py"})
|
||||||
|
with urllib.request.urlopen(req, timeout=300) as r:
|
||||||
|
page = json.load(r)
|
||||||
|
if not isinstance(page, dict) or page.get("error"):
|
||||||
|
raise SourceError(f"{query_url}: the service answered with an error: "
|
||||||
|
f"{(page or {}).get('error') if isinstance(page, dict) else page!r}")
|
||||||
|
return page
|
||||||
|
|
||||||
|
|
||||||
def _arcgis_geojson(query_url, where, out_fields, dest):
|
def _arcgis_geojson(query_url, where, out_fields, dest):
|
||||||
"""Page an ArcGIS query into one cached GeoJSON file, in lon/lat."""
|
"""Page an ArcGIS query into one cached GeoJSON file, in lon/lat.
|
||||||
|
|
||||||
|
The service is first asked how many features match; the download must bring exactly
|
||||||
|
that many, or it raises. A page is never taken as the last one just because it is short
|
||||||
|
(a service may cap a page below the size asked for); paging stops when a page is empty
|
||||||
|
or the count is reached."""
|
||||||
|
count = _arcgis_get(query_url, {"where": where, "returnCountOnly": "true", "f": "json"})
|
||||||
|
want = count.get("count")
|
||||||
|
if not isinstance(want, int) or want <= 0:
|
||||||
|
raise SourceError(f"{query_url}: the service reports {want!r} features for {where!r}")
|
||||||
features, offset = [], 0
|
features, offset = [], 0
|
||||||
while True:
|
while len(features) < want:
|
||||||
params = {"where": where, "outFields": out_fields, "returnGeometry": "true",
|
params = {"where": where, "outFields": out_fields, "returnGeometry": "true",
|
||||||
"outSR": "4326", "f": "geojson", "resultRecordCount": "1000",
|
"outSR": "4326", "f": "geojson", "resultRecordCount": "1000",
|
||||||
"resultOffset": str(offset), "orderByFields": "OBJECTID"}
|
"resultOffset": str(offset), "orderByFields": "OBJECTID"}
|
||||||
url = query_url + "?" + urllib.parse.urlencode(params)
|
got = _arcgis_get(query_url, params).get("features") or []
|
||||||
req = urllib.request.Request(url, headers={"User-Agent": "longhikes place_trails.py"})
|
if not got:
|
||||||
with urllib.request.urlopen(req, timeout=300) as r:
|
|
||||||
page = json.load(r)
|
|
||||||
got = page.get("features") or []
|
|
||||||
features.extend(got)
|
|
||||||
if len(got) < 1000:
|
|
||||||
break
|
break
|
||||||
|
features.extend(got)
|
||||||
offset += len(got)
|
offset += len(got)
|
||||||
|
if len(features) != want:
|
||||||
|
raise SourceError(f"{query_url}: downloaded {len(features)} features, but the service "
|
||||||
|
f"reports {want}")
|
||||||
|
if not any(f.get("geometry") for f in features):
|
||||||
|
raise SourceError(f"{query_url}: every feature came back with no geometry")
|
||||||
with open(dest, "w", encoding="utf-8") as f:
|
with open(dest, "w", encoding="utf-8") as f:
|
||||||
json.dump({"type": "FeatureCollection", "features": features}, f)
|
json.dump({"type": "FeatureCollection", "features": features}, f)
|
||||||
|
|
||||||
@@ -338,8 +373,7 @@ def _read_vector(path, columns=None, bbox=None):
|
|||||||
import pyogrio
|
import pyogrio
|
||||||
import pyogrio.raw
|
import pyogrio.raw
|
||||||
from pyproj import Transformer
|
from pyproj import Transformer
|
||||||
from shapely import from_wkb
|
from shapely import from_wkb, transform
|
||||||
from shapely.ops import transform
|
|
||||||
if str(path).endswith(".zip"):
|
if str(path).endswith(".zip"):
|
||||||
import zipfile
|
import zipfile
|
||||||
with zipfile.ZipFile(path) as z:
|
with zipfile.ZipFile(path) as z:
|
||||||
@@ -361,7 +395,7 @@ def _read_vector(path, columns=None, bbox=None):
|
|||||||
for row, wkb in zip(rows, geoms):
|
for row, wkb in zip(rows, geoms):
|
||||||
g = from_wkb(wkb) if wkb is not None else None
|
g = from_wkb(wkb) if wkb is not None else None
|
||||||
if g is not None and transformer is not None:
|
if g is not None and transformer is not None:
|
||||||
g = transform(transformer.transform, g)
|
g = transform(g, transformer.transform, interleaved=False)
|
||||||
row["_geometry"] = g if g is None or g.is_valid else g.buffer(0)
|
row["_geometry"] = g if g is None or g.is_valid else g.buffer(0)
|
||||||
return rows
|
return rows
|
||||||
|
|
||||||
@@ -491,6 +525,9 @@ def default_allowlist_path():
|
|||||||
# permanent, so this is a decision made once.
|
# permanent, so this is a decision made once.
|
||||||
SLUG_KEEPS_PLAIN = {
|
SLUG_KEEPS_PLAIN = {
|
||||||
("wilderness", "wilderness-connect", "239"), # Hells Canyon Wilderness, Idaho and Oregon
|
("wilderness", "wilderness-connect", "239"), # Hells Canyon Wilderness, Idaho and Oregon
|
||||||
|
# Glacier National Park, Montana; CPCAD's "Glacier National Park Of Canada" (British
|
||||||
|
# Columbia, no trails here) cleans to the same name and takes glacier-national-park-bc.
|
||||||
|
("park", "nps", "GLAC"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -590,6 +627,15 @@ def merge_same_name(outlines):
|
|||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def _read_source(key, cache):
|
||||||
|
"""A source's outlines, or SourceError when it yields none."""
|
||||||
|
path, _ver = fetch(SOURCES[key], cache)
|
||||||
|
rows = SOURCES[key].read(path)
|
||||||
|
if not rows:
|
||||||
|
raise SourceError(f"{key} ({SOURCES[key].url}): the downloaded file holds no outlines")
|
||||||
|
return rows
|
||||||
|
|
||||||
|
|
||||||
def catalogue(cache, allowlist=None):
|
def catalogue(cache, allowlist=None):
|
||||||
"""The outlines to measure: parks whole, wilderness whole, ranges allow-listed only."""
|
"""The outlines to measure: parks whole, wilderness whole, ranges allow-listed only."""
|
||||||
allowlist = allowlist if allowlist is not None else load_allowlist(default_allowlist_path())
|
allowlist = allowlist if allowlist is not None else load_allowlist(default_allowlist_path())
|
||||||
@@ -598,8 +644,8 @@ def catalogue(cache, allowlist=None):
|
|||||||
joined = [p for p in allowlist["park"] if isinstance(p.get("source_id"), list)]
|
joined = [p for p in allowlist["park"] if isinstance(p.get("source_id"), list)]
|
||||||
joined_ids = {str(s) for p in joined for s in p["source_id"]}
|
joined_ids = {str(s) for p in joined for s in p["source_id"]}
|
||||||
out = []
|
out = []
|
||||||
path, _ver = fetch(SOURCES["nps"], cache)
|
nps = _read_source("nps", cache)
|
||||||
for o in SOURCES["nps"].read(path):
|
for o in nps:
|
||||||
if str(o.source_id) in joined_ids:
|
if str(o.source_id) in joined_ids:
|
||||||
continue
|
continue
|
||||||
extra = extras.get(str(o.source_id))
|
extra = extras.get(str(o.source_id))
|
||||||
@@ -610,17 +656,15 @@ def catalogue(cache, allowlist=None):
|
|||||||
o.where_hand = tuple(extra.get("where") or ())
|
o.where_hand = tuple(extra.get("where") or ())
|
||||||
out.append(o)
|
out.append(o)
|
||||||
for p in joined:
|
for p in joined:
|
||||||
parts = [o for o in SOURCES["nps"].read(path) if str(o.source_id) in [str(s) for s in p["source_id"]]]
|
parts = [o for o in nps if str(o.source_id) in [str(s) for s in p["source_id"]]]
|
||||||
if parts:
|
if parts:
|
||||||
out.append(Outline("park", "nps", [str(s) for s in p["source_id"]],
|
out.append(Outline("park", "nps", [str(s) for s in p["source_id"]],
|
||||||
p.get("name") or parts[0].name,
|
p.get("name") or parts[0].name,
|
||||||
sorted({h for o in parts for h in o.state_codes_hint}),
|
sorted({h for o in parts for h in o.state_codes_hint}),
|
||||||
_union_geoms(o.geometry for o in parts),
|
_union_geoms(o.geometry for o in parts),
|
||||||
slug=p.get("slug") or "", where_hand=tuple(p.get("where") or ())))
|
slug=p.get("slug") or "", where_hand=tuple(p.get("where") or ())))
|
||||||
path, _ver = fetch(SOURCES["cpcad"], cache)
|
out.extend(_read_source("cpcad", cache))
|
||||||
out.extend(SOURCES["cpcad"].read(path))
|
out.extend(_read_source("wilderness-connect", cache))
|
||||||
path, _ver = fetch(SOURCES["wilderness-connect"], cache)
|
|
||||||
out.extend(SOURCES["wilderness-connect"].read(path))
|
|
||||||
wanted = {str(r.get("gmba_id")): r for r in allowlist["range"]}
|
wanted = {str(r.get("gmba_id")): r for r in allowlist["range"]}
|
||||||
if wanted:
|
if wanted:
|
||||||
for g in gmba_ranges(cache):
|
for g in gmba_ranges(cache):
|
||||||
@@ -642,8 +686,7 @@ _GMBA_CACHE = {}
|
|||||||
|
|
||||||
def gmba_ranges(cache):
|
def gmba_ranges(cache):
|
||||||
if cache not in _GMBA_CACHE:
|
if cache not in _GMBA_CACHE:
|
||||||
path, _ver = fetch(SOURCES["gmba-v2"], cache)
|
_GMBA_CACHE[cache] = _read_source("gmba-v2", cache)
|
||||||
_GMBA_CACHE[cache] = SOURCES["gmba-v2"].read(path)
|
|
||||||
return _GMBA_CACHE[cache]
|
return _GMBA_CACHE[cache]
|
||||||
|
|
||||||
|
|
||||||
@@ -1239,22 +1282,61 @@ def stamp_none(root, rid, today):
|
|||||||
_save(doc, path)
|
_save(doc, path)
|
||||||
|
|
||||||
|
|
||||||
|
def missing_from_sources(entries, outlines):
|
||||||
|
"""Registry entries measured from a track whose outline the sources no longer hold, as
|
||||||
|
"kind/slug (source id)". An outline that went missing (a failed or short download, a
|
||||||
|
renamed field, a moved layer) is an error to fix, never a place with no trails."""
|
||||||
|
have = set()
|
||||||
|
for o in outlines:
|
||||||
|
for i in (o.source_id if isinstance(o.source_id, list) else [o.source_id]):
|
||||||
|
have.add((o.source, str(i)))
|
||||||
|
out = []
|
||||||
|
for e in entries:
|
||||||
|
if e.get("source") not in SOURCES:
|
||||||
|
continue
|
||||||
|
ids = e.get("source_id")
|
||||||
|
for i in (ids if isinstance(ids, list) else [ids]):
|
||||||
|
if (e["source"], str(i)) not in have:
|
||||||
|
out.append(f"{e.get('kind')}/{e.get('slug')} ({e['source']} {i})")
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
def check(root, cache, outlines=None, versions=None, records=None):
|
def check(root, cache, outlines=None, versions=None, records=None):
|
||||||
"""Re-measure every track against the current outlines; one difference per line."""
|
"""Re-measure every track against the current outlines; one difference per line.
|
||||||
|
|
||||||
|
A source_version that differs is not a difference: every source here is versioned by
|
||||||
|
its download date, so a fresh download always differs. What the outline does to the
|
||||||
|
trails is what is compared; `apply` stamps the new date when a difference is applied.
|
||||||
|
`versions` is accepted and unused, for callers that still pass it."""
|
||||||
if outlines is None:
|
if outlines is None:
|
||||||
outlines = catalogue(cache)
|
outlines = catalogue(cache)
|
||||||
if versions is None:
|
|
||||||
versions = source_versions(cache)
|
|
||||||
if records is None:
|
if records is None:
|
||||||
records = load_records(root)
|
records = load_records(root)
|
||||||
|
lost = missing_from_sources(registry_entries(root), outlines)
|
||||||
|
if lost:
|
||||||
|
raise SourceError("the sources no longer hold the outline of " + str(len(lost))
|
||||||
|
+ " registered place(s): " + ", ".join(lost))
|
||||||
p = propose(records, outlines, {(e.get("kind"), e.get("slug")): e.get("where")
|
p = propose(records, outlines, {(e.get("kind"), e.get("slug")): e.get("where")
|
||||||
for e in registry_entries(root)})
|
for e in registry_entries(root)})
|
||||||
diffs = []
|
diffs = []
|
||||||
current_counts = {}
|
# Both counts are taken the same way: a record's places as stored (no parents), with
|
||||||
|
# the track's measured places in place of its stored track places. Stated places (hand
|
||||||
|
# placements from a cited page) are on both sides; a check that left them off one side
|
||||||
|
# reported every park held up by stated trails as losing them.
|
||||||
|
current_counts, new_counts = {}, {}
|
||||||
for r in records:
|
for r in records:
|
||||||
for pl in (r.get("rec") or {}).get("place") or []:
|
rec = r.get("rec") or {}
|
||||||
current_counts[(pl.get("kind"), pl.get("slug"))] = \
|
stored = {(pl.get("kind"), pl.get("slug")) for pl in rec.get("place") or []}
|
||||||
current_counts.get((pl.get("kind"), pl.get("slug")), 0) + 1
|
for k in stored:
|
||||||
|
current_counts[k] = current_counts.get(k, 0) + 1
|
||||||
|
if r.get("track") is None:
|
||||||
|
now = stored
|
||||||
|
else:
|
||||||
|
now = {(pl.get("kind"), pl.get("slug")) for pl in rec.get("place") or []
|
||||||
|
if pl.get("basis") != "track"}
|
||||||
|
now |= {k for k, _km in p.per_trail.get(r["id"], [])}
|
||||||
|
for k in now:
|
||||||
|
new_counts[k] = new_counts.get(k, 0) + 1
|
||||||
for r in records:
|
for r in records:
|
||||||
rec = r.get("rec") or {}
|
rec = r.get("rec") or {}
|
||||||
if r.get("track") is None:
|
if r.get("track") is None:
|
||||||
@@ -1272,7 +1354,6 @@ def check(root, cache, outlines=None, versions=None, records=None):
|
|||||||
tdir = os.path.join(root, r["id"])
|
tdir = os.path.join(root, r["id"])
|
||||||
if rec.get("places_track") and line_file_of(tdir) and track_hash(tdir) != rec["places_track"]:
|
if rec.get("places_track") and line_file_of(tdir) and track_hash(tdir) != rec["places_track"]:
|
||||||
diffs.append(f"{r['id']}: the track has changed since its places were measured")
|
diffs.append(f"{r['id']}: the track has changed since its places were measured")
|
||||||
new_counts = {k: len(h.trails) for k, h in p.per_place.items()}
|
|
||||||
for k in sorted(set(current_counts) | set(new_counts)):
|
for k in sorted(set(current_counts) | set(new_counts)):
|
||||||
was, now = current_counts.get(k, 0) >= 3, new_counts.get(k, 0) >= 3
|
was, now = current_counts.get(k, 0) >= 3, new_counts.get(k, 0) >= 3
|
||||||
if was != now:
|
if was != now:
|
||||||
@@ -1287,11 +1368,6 @@ def check(root, cache, outlines=None, versions=None, records=None):
|
|||||||
for k in sorted(doubled_places(final, shown)):
|
for k in sorted(doubled_places(final, shown)):
|
||||||
diffs.append(f"{k[0]}/{k[1]}: holds exactly the trails of a park of the same name; "
|
diffs.append(f"{k[0]}/{k[1]}: holds exactly the trails of a park of the same name; "
|
||||||
f"list the park only")
|
f"list the park only")
|
||||||
for e in registry_entries(root):
|
|
||||||
v = versions.get(e.get("source"))
|
|
||||||
if v and e.get("source_version") and e["source_version"] != v:
|
|
||||||
diffs.append(f"{e.get('kind')}/{e.get('slug')}: source_version changed "
|
|
||||||
f"from {e['source_version']} to {v}")
|
|
||||||
return diffs
|
return diffs
|
||||||
|
|
||||||
|
|
||||||
@@ -1393,7 +1469,11 @@ def main(argv=None):
|
|||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
if cmd == "--check":
|
if cmd == "--check":
|
||||||
diffs = check(ROOT, cache_dir())
|
try:
|
||||||
|
diffs = check(ROOT, cache_dir())
|
||||||
|
except SourceError as e:
|
||||||
|
print(f"place_trails.py: an outline source failed: {e}", file=sys.stderr)
|
||||||
|
return 3
|
||||||
for d in diffs:
|
for d in diffs:
|
||||||
print(d)
|
print(d)
|
||||||
print(f"{len(diffs)} difference(s)" if diffs else "no differences")
|
print(f"{len(diffs)} difference(s)" if diffs else "no differences")
|
||||||
|
|||||||
@@ -670,7 +670,9 @@ class ApplyTest(unittest.TestCase):
|
|||||||
records=records)
|
records=records)
|
||||||
text = "\n".join(diffs)
|
text = "\n".join(diffs)
|
||||||
self.assertIn("measurement changed", text) # the moved boundary
|
self.assertIn("measurement changed", text) # the moved boundary
|
||||||
gone = outline("park", "P9", "Elsewhere Park",
|
# The same outline, redrawn away from every track (a missing outline is an error:
|
||||||
|
# FailedSourceTest).
|
||||||
|
gone = outline("park", "P1", "Alpha Park",
|
||||||
Polygon([(-100, 43), (-99, 43), (-99, 44), (-100, 44)]), hint=["WY"])
|
Polygon([(-100, 43), (-99, 43), (-99, 44), (-100, 44)]), hint=["WY"])
|
||||||
diffs = P.check(self.root, None, outlines=[gone], versions={"nps": "2026-11-20"},
|
diffs = P.check(self.root, None, outlines=[gone], versions={"nps": "2026-11-20"},
|
||||||
records=records)
|
records=records)
|
||||||
@@ -693,5 +695,104 @@ class ApplyTest(unittest.TestCase):
|
|||||||
self.assertEqual(errors, [])
|
self.assertEqual(errors, [])
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipUnless(HAVE, "shapely (the .venv-places venv) is not installed")
|
||||||
|
class FailedSourceTest(unittest.TestCase):
|
||||||
|
"""The 2026-12-01 monthly check: a missing outline or a stated placement must never
|
||||||
|
read as a park with no trails, and a fresh download date alone is no difference."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.tmp = tempfile.TemporaryDirectory()
|
||||||
|
self.root = self.tmp.name
|
||||||
|
make_repo(self.root)
|
||||||
|
self.park = outline("park", "P1", "Alpha Park",
|
||||||
|
Polygon([(-110, 43), (-109, 43), (-109, 44), (-110, 44)]), hint=["WY"])
|
||||||
|
track = LineString([(-109.5, 43.2), (-109.5, 43.29)])
|
||||||
|
p = P.propose([rec(r, ["WY"], track) for r in ("aa", "bb", "cc")] + [rec("zz", ["WY"], None)],
|
||||||
|
[self.park])
|
||||||
|
p.versions = {"nps": "2026-11-20"}
|
||||||
|
pdir = os.path.join(self.root, "out")
|
||||||
|
P.render_proposal(p, os.path.join(pdir, "proposal.md"))
|
||||||
|
P.apply(os.path.join(pdir, "proposal.json"), self.root, "2026-11-20")
|
||||||
|
self.records = P.load_records(self.root)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.tmp.cleanup()
|
||||||
|
|
||||||
|
def test_an_outline_missing_from_the_sources_fails_naming_it_instead_of_zero_trails(self):
|
||||||
|
elsewhere = outline("park", "P9", "Elsewhere Park",
|
||||||
|
Polygon([(-100, 43), (-99, 43), (-99, 44), (-100, 44)]), hint=["WY"])
|
||||||
|
with self.assertRaises(P.SourceError) as e:
|
||||||
|
P.check(self.root, None, outlines=[elsewhere], records=self.records)
|
||||||
|
self.assertIn("park/alpha-park (nps P1)", str(e.exception))
|
||||||
|
|
||||||
|
def test_an_empty_source_file_fails_naming_the_source(self):
|
||||||
|
with tempfile.TemporaryDirectory() as cache:
|
||||||
|
src = P.SOURCES["nps"]
|
||||||
|
with open(os.path.join(cache, src.filename), "w") as f:
|
||||||
|
json.dump({"type": "FeatureCollection", "features": []}, f)
|
||||||
|
with self.assertRaises(P.SourceError) as e:
|
||||||
|
P.catalogue(cache, {"park": [], "range": []})
|
||||||
|
self.assertIn("nps", str(e.exception))
|
||||||
|
|
||||||
|
def test_a_short_or_failed_arcgis_download_fails(self):
|
||||||
|
def feats(n):
|
||||||
|
return [{"type": "Feature", "properties": {"UNIT_CODE": "X"},
|
||||||
|
"geometry": {"type": "Point", "coordinates": [0, 0]}}] * n
|
||||||
|
real = P._arcgis_get
|
||||||
|
with tempfile.TemporaryDirectory() as d:
|
||||||
|
dest = os.path.join(d, "out.geojson")
|
||||||
|
try:
|
||||||
|
# The service caps a page at 600 though 1000 were asked: all 1500 still come.
|
||||||
|
pages = iter([{"count": 1500}, {"features": feats(600)},
|
||||||
|
{"features": feats(600)}, {"features": feats(300)}])
|
||||||
|
P._arcgis_get = lambda url, params: next(pages)
|
||||||
|
P._arcgis_geojson("u", "1=1", "*", dest)
|
||||||
|
with open(dest) as f:
|
||||||
|
self.assertEqual(len(json.load(f)["features"]), 1500)
|
||||||
|
# The service stops answering features partway: an error, not a short file.
|
||||||
|
pages = iter([{"count": 1500}, {"features": feats(1000)}, {"features": []}])
|
||||||
|
P._arcgis_get = lambda url, params: next(pages)
|
||||||
|
with self.assertRaises(P.SourceError):
|
||||||
|
P._arcgis_geojson("u", "1=1", "*", dest + "2")
|
||||||
|
self.assertFalse(os.path.exists(dest + "2"))
|
||||||
|
finally:
|
||||||
|
P._arcgis_get = real
|
||||||
|
|
||||||
|
def test_stated_placements_count_on_both_sides_of_the_three_trail_line(self):
|
||||||
|
# Alpha Park holds two measured trails and one stated (cc has no track): three, a page.
|
||||||
|
with tempfile.TemporaryDirectory() as root:
|
||||||
|
make_repo(root)
|
||||||
|
cc = os.path.join(root, "cc", "trail.toml")
|
||||||
|
with open(cc) as f:
|
||||||
|
text = f.read()
|
||||||
|
with open(cc, "w") as f:
|
||||||
|
f.write(text.replace('line_file = "line.geojson"', 'line_file = ""'))
|
||||||
|
track = LineString([(-109.5, 43.2), (-109.5, 43.29)])
|
||||||
|
p = P.propose([rec("aa", ["WY"], track), rec("bb", ["WY"], track),
|
||||||
|
rec("cc", ["WY"], None), rec("zz", ["WY"], None)], [self.park])
|
||||||
|
p.versions = {"nps": "2026-11-20"}
|
||||||
|
P.render_proposal(p, os.path.join(root, "out", "proposal.md"))
|
||||||
|
P.apply(os.path.join(root, "out", "proposal.json"), root, "2026-11-20")
|
||||||
|
P.add_stated(root, "cc", "park", "alpha-park", "https://example.org/cc",
|
||||||
|
"The trail runs through Alpha Park.", "2026-11-20")
|
||||||
|
records = P.load_records(root)
|
||||||
|
self.assertEqual(P.check(root, None, outlines=[self.park],
|
||||||
|
versions={"nps": "2026-11-20"}, records=records), [])
|
||||||
|
|
||||||
|
def test_a_new_download_date_alone_is_no_difference(self):
|
||||||
|
self.assertEqual(P.check(self.root, None, outlines=[self.park],
|
||||||
|
versions={"nps": "2026-12-01"}, records=self.records), [])
|
||||||
|
|
||||||
|
def test_montanas_glacier_keeps_the_plain_slug_beside_canadas(self):
|
||||||
|
geom = Polygon([(-110, 43), (-109, 43), (-109, 44), (-110, 44)])
|
||||||
|
mt = outline("park", "GLAC", "Glacier National Park", geom,
|
||||||
|
slug="glacier-national-park", hint=["MT"])
|
||||||
|
bc = outline("park", "713700000", "Glacier National Park", geom, slug="", hint=["BC"])
|
||||||
|
bc.slug = ""
|
||||||
|
bc.source = "cpcad"
|
||||||
|
P.assign_slugs([mt, bc])
|
||||||
|
self.assertEqual((mt.slug, bc.slug), ("glacier-national-park", "glacier-national-park-bc"))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
Reference in new issue
Block a user