From eb444ff0e64e9f07bba140860f5a3549078bfd3a Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 13 Nov 2026 12:43:49 -0700 Subject: [PATCH] Say "track" on the site for a trail's geometry The pages called the thing a hiker downloads and sees on the map a "line". They now call it a track, name the format on download links ("Download GPX and GeoJSON"), and speak of the map where the text is about what is drawn. Field and file names shown on purpose keep "line" (line.geojson, line_policy). Co-Authored-By: Claude Fable 5.2 --- web/assets/app.js | 6 +-- web/build.py | 24 +++++----- web/olt/common.py | 22 ++++----- web/olt/docs.py | 56 ++++++++++++---------- web/olt/home.py | 34 +++++++------- web/olt/layout.py | 6 +-- web/olt/regions.py | 22 ++++----- web/olt/trail.py | 101 ++++++++++++++++++++-------------------- web/olt/words.py | 18 +++---- web/site.toml | 2 +- web/tests/test_extra.py | 9 ++-- web/tests/test_pages.py | 15 +++--- 12 files changed, 163 insertions(+), 152 deletions(-) diff --git a/web/assets/app.js b/web/assets/app.js index 5ac3859..ef03616 100644 --- a/web/assets/app.js +++ b/web/assets/app.js @@ -330,10 +330,10 @@ function fail(reason) { if (entry.ready) return; host.dataset.state = 'fallback'; - status.textContent = 'Base map unavailable (' + reason + '). The line is drawn on a plain graticule.'; + status.textContent = 'Base map unavailable (' + reason + '). The track is drawn on a plain graticule.'; } - status.textContent = 'Loading the line…'; + status.textContent = 'Loading the track…'; var dataReady = fetch(fig.dataset.src, { credentials: 'same-origin' }) .then(function (r) { if (!r.ok) throw new Error(r.status); @@ -357,7 +357,7 @@ }) .catch(function () { host.dataset.state = 'error'; - status.textContent = 'The line data did not load. Downloads on this page are unaffected.'; + status.textContent = 'The track data did not load. Downloads on this page are unaffected.'; return null; }); diff --git a/web/build.py b/web/build.py index 95b15fb..28bbe43 100644 --- a/web/build.py +++ b/web/build.py @@ -249,12 +249,12 @@ def build_trail(rec, out_dir, code_mtime, force, stats): "Simplified to 5 m, 6 decimals", "GPX")) if "alternates" in files: downloads.append(download(tdir, f"{tid}-alternates.geojson", "alternates", - "Alternate and connector lines, full resolution", "GeoJSON")) + "Alternate and connector tracks, full resolution", "GeoJSON")) downloads.append(download(tdir, f"{tid}-alternates.gpx", "alternates", - "Alternate and connector lines, simplified to 5 m", "GPX")) + "Alternate and connector tracks, simplified to 5 m", "GPX")) for source in files.get("extracts", {}): downloads.append(download(tdir, f"{tid}-{source}.geojson", "extract", - f"Line as served by source '{source}', full resolution", "GeoJSON")) + f"Track as served by source '{source}', full resolution", "GeoJSON")) return downloads, cache or {} @@ -336,28 +336,28 @@ def archive_readme(name): if ext == ".gpx": what = "simplified to 5 m" resolution = ("The GPX files are simplified to 5 m, with coordinates to 6 decimal places.\n" - "The full-resolution lines are in all-geojson.zip.\n") + "The full-resolution tracks are in all-geojson.zip.\n") else: what = "full resolution" - resolution = ("The GeoJSON files are the full-resolution lines, as published in this dataset.\n" + resolution = ("The GeoJSON files are the full-resolution tracks, as published in this dataset.\n" "The simplified GPX files (5 m) are in all-gpx.zip.\n") - rows = [(f"/{ext}", f"the main line, {what}"), - (f"/-alternates{ext}", f"alternate and connector lines, {what}, where the\n" + rows = [(f"/{ext}", f"the main track, {what}"), + (f"/-alternates{ext}", f"alternate and connector tracks, {what}, where the\n" "source serves them separately"), - ("/release.txt", "the source, licence and date the line files came from")] + ("/release.txt", "the source, licence and date the track files came from")] width = max(len(p) for p, _ in rows) + 3 files = "" for path, what_it_is in rows: files += " " + path.ljust(width) + what_it_is.replace("\n", "\n" + " " * (width + 2)) + "\n" - return (f"{site_name() or 'Long trails'}: every {kind} line\n\n" - "For each trail or route whose record includes a line:\n\n" + return (f"{site_name() or 'Long trails'}: every track, as {kind}\n\n" + "For each trail or route whose record includes a track:\n\n" f"{files}\n" "and at the top:\n\n" " trails.csv one row per record, with its licence\n" " SOURCES.md each source, its terms, and the trails that use it\n\n" - "Terms. Each line keeps its source's terms and needs its source's credit, as\n" + "Terms. Each track keeps its source's terms and needs its source's credit, as\n" "given in its /release.txt (the Licence and Attribution lines) and in\n" - "trails.csv (the licence column). Lines from OpenStreetMap are\n" + "trails.csv (the licence column). Tracks from OpenStreetMap are\n" "© OpenStreetMap contributors, under the ODbL. The records themselves are\n" "public domain (CC0-1.0).\n\n" f"{resolution}") diff --git a/web/olt/common.py b/web/olt/common.py index 7094404..5b35cd9 100644 --- a/web/olt/common.py +++ b/web/olt/common.py @@ -27,9 +27,9 @@ LENGTH_LIMIT = 15.0 def line_differs(rec): - """True when the record has a line, the line was measured, and the measured + """True when the record has a track, the track was measured, and the measured length differs from the published length by more than 15%. The one test of - a partial line used by every page.""" + a partial track used by every page.""" v = rec.get("verification", {}) diff = v.get("difference_percent") return bool(has_line(rec) and v.get("verified") and diff is not None @@ -37,15 +37,15 @@ def line_differs(rec): def line_short(rec): - """line_differs, and the measured line is the shorter: the line is partial.""" + """line_differs, and the measured track is the shorter: the track is partial.""" return line_differs(rec) and rec["verification"]["difference_percent"] < 0 def partial_short_text(rec): - """The short form for lists: "Line measures 2.0 km of 1,100 km published".""" + """The short form for lists: "Track measures 2.0 km of 1,100 km published".""" v = rec["verification"] word = "of" if v["difference_percent"] < 0 else "against" - return (f"Line measures {words.fmt_km1(v['measured_km'])} km {word} " + return (f"Track measures {words.fmt_km1(v['measured_km'])} km {word} " f"{words.fmt_km(rec['length_km'])} km published") @@ -96,7 +96,7 @@ def designated_year(rec): def short_source(rec): - """A short name for where the included line came from, for lists.""" + """A short name for where the included track came from, for lists.""" src = rec.get("source", {}) if src.get("osm_only"): name = "OpenStreetMap" @@ -124,9 +124,9 @@ def rich(text): def absent_reason_short(rec): - """line_absent_reason without the opening "No line is included." (the status already says so).""" + """line_absent_reason without the opening "No line is included." or "No track is included." (the status already says so).""" reason = rec.get("source", {}).get("line_absent_reason", "") - return re.sub(r"^No line is included\.\s*", "", reason) or reason + return re.sub(r"^No (?:line|track) is included\.\s*", "", reason) or reason def regions_html(rec, linked=False): @@ -147,7 +147,7 @@ def regions_html(rec, linked=False): def tags(rec, with_policy=True): - """Kind, tier and listing tags, and (with_policy) the line policy of a route.""" + """Kind, tier and listing tags, and (with_policy) the track policy of a route.""" out = [] if is_route(rec): out.append('Person-defined route') @@ -167,8 +167,8 @@ def tags(rec, with_policy=True): def policy_chip(value): lab, short = words.label(words.POLICIES, value), words.meaning(words.POLICIES, value) - return Markup(f'' - f'Line policy: {esc(lab)}') + return Markup(f'' + f'Track policy: {esc(lab)}') def logo_img(rec, alt, eager=False): diff --git a/web/olt/docs.py b/web/olt/docs.py index eabec7d..a5fc5d7 100644 --- a/web/olt/docs.py +++ b/web/olt/docs.py @@ -148,7 +148,7 @@ def sources_page(records, site, repo_root): return sum(1 for r in recs if r.get("verification", {}).get("verified")) n_measured = measured(records) - status_cells = (f'
Line measured
{n_measured}Records whose line was ' + status_cells = (f'
Track measured
{n_measured}Records whose track was ' f'downloaded and measured (verification), whatever its source
') for key in ("verified", "osm-only", "found", "none"): recs = by_status.get(key, []) @@ -168,31 +168,37 @@ def sources_page(records, site, repo_root): f'{lines}{_record_links(recs)}') return rows + def source_label(k): + # A record with no track holds a value such as "none (no line included)"; say it in words. + if str(k).strip().lower().startswith(("none (no line", "none (no track")): + return "None (no track included)" + return esc(k) + def lic_label(k): return Markup(f'{esc(words.label(words.LICENCES, k))} {esc(k)}') head = ('{0}Records' - 'With a lineTrails and routes') + 'With a trackTrails and routes') computed = f"""

At a glance

Counted from the {len(records)} records. Each trail page names its own source, licence and credit. - The source status says where a line was looked for; whether it was measured is counted separately.

+ The source status says where a track was looked for; whether it was measured is counted separately.

{status_cells}
{f'

Other source status values: {esc(", ".join(map(str, other)))}.

' if other else ""}

By licence

{head.format("Licence")} {group_rows(by_licence, lic_label)}
-

By line source

- {head.format("Line source")} - {group_rows(by_source, esc)}
+

By track source

+ {head.format("Track source")} + {group_rows(by_source, source_label)}
""" doc_html = render_doc(read_doc(repo_root, "SOURCES.md"), site, drop_h1=True) body = (f'
' f'

Provenance

Sources

' - f'

Where the lines come from, and the terms each source states.

' + f'

Where the tracks come from, and the terms each source states.

' f'
{computed}' f'
{doc_html}
') - return "Sources", "Where each trail line comes from: licences, line sources and source terms.", Markup(body) + return "Sources", "Where each trail track comes from: licences, track sources and source terms.", Markup(body) def logos_page(records, site, repo_root): @@ -259,14 +265,14 @@ def _size(out_dir, relpath): # The bulk files on /data/: (name, what it holds, offered as a download). # trails.json and overview.geojson are what the pages fetch; a browser shows them. BULK_FILES = ( - ("trails.csv", "One row per trail: id, name, country, regions, length, kind, line policy and status.", True), + ("trails.csv", "One row per trail: id, name, country, regions, length, kind, track policy and status.", True), ("trails.json", "Every record in full, as JSON, with the derived fields the site builds.", False), - ("index.geojson", "Every included line, simplified to about 100 m, with id and name.", True), - ("overview.geojson", "Every included line simplified to about 750 m for the overview map, " + ("index.geojson", "Every included track, simplified to about 100 m, with id and name.", True), + ("overview.geojson", "Every included track simplified to about 750 m for the overview map, " "with id, name, kind, country and length.", False), - ("all-gpx.zip", "Every GPX file (main lines and alternates, simplified to 5 m), as /, " + ("all-gpx.zip", "Every GPX file (main tracks and alternates, simplified to 5 m), as /, " "with each trail's release.txt, trails.csv, SOURCES.md and a README.", True), - ("all-geojson.zip", "Every full-resolution GeoJSON main line and alternates file, as /, " + ("all-geojson.zip", "Every full-resolution GeoJSON main track and alternates file, as /, " "with each trail's release.txt, trails.csv, SOURCES.md and a README.", True), ) @@ -280,7 +286,7 @@ def _licence_text_url(licence, repo_root): def line_licence_rows(records, repo_root): - """(what, terms, text URL) for each licence the included lines carry, from the records.""" + """(what, terms, text URL) for each licence the included tracks carry, from the records.""" by_licence = _group_by([r for r in records if common.has_line(r)], lambda r: r.get("source", {}).get("licence", "") or "unknown") rows = [] @@ -288,7 +294,7 @@ def line_licence_rows(records, repo_root): recs = by_licence[lic] label = words.label(words.LICENCES, lic) n = len(recs) - what = f"Lines licensed {esc(label)}: {n} record{'s' if n != 1 else ''}" + what = f"Tracks licensed {esc(label)}: {n} record{'s' if n != 1 else ''}" if n <= 3: links = ", ".join(f'{common.name(r)}' for r in recs) what += f" ({links})" @@ -306,13 +312,13 @@ def data_page(records, site, repo_root, out_dir): rows += (f'/data/{esc(name)}' f'{esc(what)}{esc(_size(out_dir, "data/" + name))}') per_trail = [ - (".geojson", "The main line at full resolution, as published in the dataset."), - (".gpx", "The main line simplified to 5 m, for GPS devices. No elevation."), - ("-alternates.geojson / .gpx", "Alternate and connector lines, where the source serves them separately."), - ("-.geojson", "One source's own extract, where a line combines sources."), - ("map.json", "The line simplified to 30 m for the trail page map (GeoJSON)."), + (".geojson", "The main track at full resolution, as published in the dataset."), + (".gpx", "The main track simplified to 5 m, for GPS devices. No elevation."), + ("-alternates.geojson / .gpx", "Alternate and connector tracks, where the source serves them separately."), + ("-.geojson", "One source's own extract, where a track combines sources."), + ("map.json", "The track simplified to 30 m for the trail page map (GeoJSON)."), ("trail.toml", "The record itself: source, licence, verification, logo and route details."), - ("release.txt", "The source, licence and date the line files came from, where a line is included."), + ("release.txt", "The source, licence and date the track files came from, where a track is included."), ("shield.svg / shield.png", "The trail logo, where one is included. Not licensed; see Logos."), ("shield-thumb.png", "A copy of a PNG logo no larger than 256 px, for the lists."), ] @@ -320,8 +326,8 @@ def data_page(records, site, repo_root, out_dir): lic_rows = [ ("Records, documents and compiled index", "CC0-1.0 (public domain)", '/licences/LICENSE'), ("Tools in tools/", "MIT", '/licences/MIT.txt'), - ("Each trail line", "Keeps its source's terms, stated in its record; see Sources", '/sources/'), - ("Lines from OpenStreetMap", "ODbL-1.0; credit © OpenStreetMap contributors", '/licences/ODbL-1.0.txt'), + ("Each trail track", "Keeps its source's terms, stated in its record; see Sources", '/sources/'), + ("Tracks from OpenStreetMap", "ODbL-1.0; credit © OpenStreetMap contributors", '/licences/ODbL-1.0.txt'), *line_licence_rows(records, repo_root), ("Trail logos", "Not licensed; belong to their holders, shown only to identify each trail", '/logos/'), ] @@ -334,7 +340,7 @@ def data_page(records, site, repo_root, out_dir):

Bulk downloads

{len(records)} records. Sizes are this build's.

{rows}
FileWhat it holdsSize
-

Each line in the archives keeps its source’s terms and needs its source’s +

Each track in the archives keeps its source’s terms and needs its source’s credit, as given in the trail’s release.txt; trails.csv gives each record’s licence too.

Per-trail files

Every record has a stable directory. Replace <id> with a record id @@ -342,7 +348,7 @@ def data_page(records, site, repo_root, out_dir): /trails/<id>/<id>.gpx, /trails/<id>/<id>-alternates.geojson (and .gpx), /trails/<id>/map.json, /trails/<id>/trail.toml and /trails/<id>/release.txt. The trail page is /trails/<id>/. - Line files exist only where the record includes a line; the record says why when it does not.

+ Track files exist only where the record includes a track; the record says why when it does not.

{prow}
File under /trails/<id>/What it holds

Licences

diff --git a/web/olt/home.py b/web/olt/home.py index 7ce1a21..f9c38b4 100644 --- a/web/olt/home.py +++ b/web/olt/home.py @@ -78,14 +78,14 @@ def entry(rec, *, level=3, extra=""): if common.has_line(rec): partial_note = (f'

{esc(common.partial_short_text(rec))}

' if partial else "") - line = (f'{common.SWATCH_ROUTE if route else common.SWATCH_LINE}Line{policy}' + line = (f'{common.SWATCH_ROUTE if route else common.SWATCH_LINE}Track{policy}' f'{partial_note}' f'GeoJSON, GPX' f'{esc(common.short_source(rec))} · {esc(common.licence_label(rec))}') note = "" else: line = f'{common.SWATCH_NONE}Record only{policy}' - note = (f'\n

Why there is no line: ' + note = (f'\n

Why there is no track: ' f'{esc(common.absent_reason_short(rec))}

') regions = " ".join(words.region_key(c, rec["country"]) for c in rec.get("regions", [])) search = " ".join([rec["name"], rec.get("short_name", ""), rec["id"]] @@ -108,7 +108,7 @@ def entry(rec, *, level=3, extra=""):
Length
{words.length(rec["length_km"], "stack", rec["derived"]["length_mi"])}
-
Line
{line}
+
Track
{line}
{note}{extra} """ @@ -154,7 +154,7 @@ def finder_form(c, steps=LENGTH_STEPS):
@@ -197,7 +197,7 @@ def finder_form(c, steps=LENGTH_STEPS): Person-defined routes {c["route"]} Worked out and published by a person or a small group - +
@@ -228,7 +228,7 @@ def list_head(): return f"""""" @@ -251,9 +251,9 @@ SORT_SELECT = """