Skip to content

MBTiles selection: client-only rect select for vector tiles#217

Merged
tmshv merged 32 commits intomasterfrom
issue-214
Apr 8, 2026
Merged

MBTiles selection: client-only rect select for vector tiles#217
tmshv merged 32 commits intomasterfrom
issue-214

Conversation

@tmshv
Copy link
Copy Markdown
Owner

@tmshv tmshv commented Apr 8, 2026

Summary

Fixes #214. MBTiles vector tile rect select now works via client-only spatial queries, with a GeoJSON overlay handling highlighting.

Previously, rect select had no effect on MBTiles sources because MVT features from `queryRenderedFeatures` lack numeric IDs when the PBF tiles don't encode them — the serialization step dropped every feature, and `setFeatureState` couldn't match anything.

Approach

  • `queryRenderedFeatures` is the sole spatial query for MVT sources (no backend spatial query)
  • New `assignFeatureIds` helper assigns synthetic sequential IDs to features without PBF IDs
  • New `MvtSelectionOverlay` renders selected features as a GeoJSON overlay (replaces `setFeatureState` for MVT sources)
  • Only solid rect (contains) mode for MVT — no intersect mode

Limitations

  • Selection limited to currently rendered features at the active zoom
  • Zoom changes after selection: highlights persist (stored as GeoJSON), but new features aren't auto-selected

tmshv added 30 commits April 8, 2026 03:48
@tmshv tmshv merged commit acfa080 into master Apr 8, 2026
11 checks passed
@tmshv tmshv deleted the issue-214 branch April 8, 2026 18:34
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.

MBTiles selection tool support

1 participant