Check the Setup
- Python 3.10 or newer
- An internet connection
- The requests Python package
State-level National Transportation Database trail segments for measuring mapped outdoor access and trail density.
Report a ProblemFrom Source to Product Signal
USGS stages state-level transportation GeoPackages containing Trans_TrailSegment. Start with the 5.8 MB District of Columbia archive; mapped segments do not prove legal public access or trail condition.
Install the packages, then run the notebook cell.
python -m pip install requests
import io
import sqlite3
import tempfile
import zipfile
from pathlib import Path
import requests
url = "https://prd-tnm.s3.amazonaws.com/StagedProducts/Tran/GPKG/TRAN_District_of_Columbia_State_GPKG.zip"
response = requests.get(url, timeout=35)
response.raise_for_status()
with zipfile.ZipFile(io.BytesIO(response.content)) as archive:
member = next(name for name in archive.namelist() if name.endswith(".gpkg"))
with tempfile.TemporaryDirectory() as directory:
path = Path(directory) / "trails.gpkg"
path.write_bytes(archive.read(member))
with sqlite3.connect(path) as db:
print(db.execute("SELECT name, lengthmiles FROM Trans_TrailSegment LIMIT 1").fetchone())Test a Useful Signal
Display one dated USGS trail record and its mapped length.
U.S. Geological Survey is a government source. Last verified 2026-09-28. Temporal coverage: periodically refreshed state and District of Columbia trail extracts.