Skip to content

fix: crisp territory boundaries at high zoom + stop power plant flashing#15

Merged
victorquinn merged 1 commit intomainfrom
fix/map-territory-detail
Feb 24, 2026
Merged

fix: crisp territory boundaries at high zoom + stop power plant flashing#15
victorquinn merged 1 commit intomainfrom
fix/map-territory-detail

Conversation

@victorquinn
Copy link
Member

Problem

  1. Blocky territories — pre-simplification with @turf/simplify at 0.05° (5.5km) tolerance destroyed boundary detail at ALL zoom levels. Territories looked blocky even at zoom 9-10 where they should be crisp.

  2. Power plants flashing — the two-tier layer system (major plants at zoom 8-9, all plants at zoom 10+) caused a tile-loading race during zoom transitions. When zooming from 9→10, the major layer would disappear before the 'all' layer loaded, making plants flash in and out.

Fix

Territories: Removed @turf/simplify pre-processing entirely. Now using original full-resolution geometry with geojson-vt's built-in zoom-dependent simplification:

  • Zoom 5-6: geojson-vt heavily simplifies → rough shapes (many polygons visible, few pixels each)
  • Zoom 9-10: geojson-vt minimally simplifies → crisp boundary detail (few polygons visible)

Zoom gating unchanged: large utilities (>50K customers) at zoom 7-8, all territories at zoom 9+.

Power plants: Replaced two-tier system with a single layer at zoom 8+. Points are lightweight; no need for the major/all split. No more flashing.

Cleanup: Removed @turf/simplify and @turf/helpers dependencies.

Territory detail:
- Removed @turf/simplify pre-processing that was destroying boundary
  detail at all zoom levels (0.05° = 5.5km tolerance was too aggressive)
- Now using original full-resolution geometry with geojson-vt's built-in
  zoom-dependent simplification: rough at zoom 5-6 (many polygons visible,
  few pixels each), crisp at zoom 9-10 (few polygons visible, many pixels)
- Zoom gating still in place: large utilities at 7-8, all at 9+

Power plant flashing:
- Replaced two-tier layer system (major at 8-9, all at 10+) with a
  single layer at zoom 8+. The maxZoom:9 on the major layer caused
  a tile-loading race during zoom transitions — plants would vanish
  as one layer disappeared before the next loaded.
- Points are lightweight; a single layer with all plants is fine.

Removed @turf/simplify and @turf/helpers dependencies (no longer needed).
@vercel
Copy link

vercel bot commented Feb 24, 2026

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

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

Request Review

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant