Skip to content

feat: add HIFLD transmission lines dataset#22

Merged
victorquinn merged 1 commit intomainfrom
feat/transmission-lines
Feb 26, 2026
Merged

feat: add HIFLD transmission lines dataset#22
victorquinn merged 1 commit intomainfrom
feat/transmission-lines

Conversation

@victorquinn
Copy link
Member

Summary

Adds US electric power transmission lines (69kV–765kV) from the HIFLD dataset to OpenGrid.

What's included

Data:

  • 52,244 transmission line segments from HIFLD ArcGIS Feature Service
  • Paginated sync script with voltage classification (extra-high/high/medium/sub-trans)
  • data/transmission-lines.json — 19MB metadata array for list/search
  • PMTiles for map rendering (public/tiles/transmission-lines.pmtiles, 56MB)

Files added/changed:

  • scripts/sync-transmission-lines.ts — ArcGIS REST API sync with pagination
  • types/transmission-lines.ts — TypeScript interfaces + VoltageClass type
  • lib/transmission-lines.ts — React hook + classification helpers
  • scripts/copy-transmission-lines.mjs — prebuild copy to public/data/
  • scripts/prepare-transmission-lines-geojson.mjs — tippecanoe prep
  • scripts/build-tiles.sh — updated to generate transmission-lines.pmtiles
  • app/api/tiles/transmission-lines/[z]/[x]/[y]/route.ts — PMTiles tile server
  • components/explorer/ExplorerMap.tsx — new line layer colored by voltage class
  • app/(shell)/transmission-lines/page.tsx — list page with search + voltage filter
  • app/(shell)/layout.tsx — Transmission nav link
  • app/(shell)/about/page.tsx + app/(shell)/page.tsx — stats updates
  • .github/workflows/sync-transmission.yml — monthly sync schedule

Map layer:

  • Renders as lines, color by voltage class (red=345kV+, orange=230kV, green=115kV, blue=69kV)
  • Visible at zoom 3+, high voltage lines prominent at low zoom via tippecanoe
  • Tooltip shows owner, voltage, status
  • Renders above territories, below power plants

Note: The transmission-lines.pmtiles file is 56MB (just over GitHub's 50MB recommendation) — it still works, but consider LFS if this becomes an issue.

npm run build  # ✅ passes

- Add 52,244 US transmission line segments (69kV-765kV) from HIFLD
- Sync script: scripts/sync-transmission-lines.ts (ArcGIS REST API with pagination)
- Type definitions: types/transmission-lines.ts
- Data loading hook: lib/transmission-lines.ts
- Copy script: scripts/copy-transmission-lines.mjs
- Tippecanoe prep: scripts/prepare-transmission-lines-geojson.mjs
- PMTiles tile generation in build-tiles.sh
- API tile route: app/api/tiles/transmission-lines/[z]/[x]/[y]/route.ts
- Map layer in ExplorerMap.tsx (color by voltage class, zoom 3+)
- List page: app/(shell)/transmission-lines/page.tsx
- Navigation update in app/(shell)/layout.tsx
- About page and homepage updates with stats
- GitHub Actions workflow: .github/workflows/sync-transmission.yml
@vercel
Copy link

vercel bot commented Feb 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opengrid Building Building Preview, Comment Feb 26, 2026 2:42am

Request Review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3329d581c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// For GCS (lat/lon), it's in decimal degrees — 1 degree ≈ 69 miles.
// For projected (meters), divide by 1609.34.
// HIFLD data uses geographic coords (degrees), so multiply by 69.
return Math.round(shapeLen * 69 * 100) / 100;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Convert Shape__Length using correct units

The length conversion currently multiplies Shape__Length by 69 as if the source units are degrees, which makes derived mile values orders of magnitude too large for this dataset and propagates bad data into data/transmission-lines.json (affecting the Length column and length-based sorting). Please convert based on the actual spatial-reference units (e.g., meters-to-miles) rather than hard-coding a degrees conversion.

Useful? React with 👍 / 👎.

result = result.filter((l) => l.voltageClass === voltageFilter);
}
if (statusFilter !== "all") {
result = result.filter((l) => l.status.toLowerCase().includes(statusFilter.toLowerCase()));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match status filter exactly for in-service rows

Filtering with includes(statusFilter) causes false matches: selecting "In Service" also returns rows whose status is "Not In Service" because that string contains the same substring. When those statuses are both present, users cannot isolate truly in-service lines; use exact normalized comparisons (or explicit status buckets) instead of substring matching.

Useful? React with 👍 / 👎.

@victorquinn victorquinn merged commit b2734df into main Feb 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant