Agent Skills
› lichtblick-suite/lichtblick
› panel-map
panel-map
GitHub基于 Leaflet 的地图可视化技能,支持 GPS/NavSatFix/GeoJSON 数据展示。核心通过像素去重网格优化海量点位渲染性能,提供瓦片配置、自动居中及批量标记操作功能。
Trigger Scenarios
需要展示 GPS 轨迹或定位点
处理高频 GPS 数据导致的前端渲染卡顿
集成 NavSatFix 或 GeoJSON 地理数据到面板
Install
npx skills add lichtblick-suite/lichtblick --skill panel-map -g -y
SKILL.md
Frontmatter
{
"name": "panel-map",
"description": "Deep Map panel knowledge: Leaflet lifecycle, NavSatFix\/LocationFix\/GeoJSON handling, tile layers, and the FilteredPointLayer pixel-deduplication grid that bounds rendering cost."
}
Panel Map Skill
A geographic visualization tool built on Leaflet for displaying GPS/NavSatFix data.
Structure
panels/Map/
├── MapPanel.tsx # main panel, Leaflet lifecycle, PanelExtensionContext
├── FilteredPointLayer.ts # performance-critical point deduplication
├── support.ts # message type detection (NavSatFix, GeoJSON, GPS)
└── config.ts # settings tree, tile layer config
Leaflet Integration
- Map instance created on mount, destroyed on unmount
- Tile layers configurable (OpenStreetMap default, custom tile servers)
- Markers use
FeatureGroupfor efficient bulk operations - View can follow the latest GPS point (auto-center)
FilteredPointLayer (Performance Critical)
Pixel-deduplication using a sparse 2D grid.
Problem
GPS at 10 Hz for 1 hour = 36,000 points. Rendering each as a Leaflet marker is prohibitively slow.
Solution
Screen space is divided into a sparse grid of pixel-sized cells.
Each cell holds at most ONE marker.
Points overlapping in screen space → only one is rendered.
On zoom change → the grid is recalculated.
Implementation
- Sparse 2D grid indexed by
`${Math.floor(pixelX)},${Math.floor(pixelY)}` - A new point mapping to an occupied cell is skipped (deduplicated)
- Result:
O(visible pixels)markers instead ofO(data points) - Zoom in → more cells visible → more points; zoom out → heavy dedup → fast
Supported Message Types
| Message Type | Fields Used |
|---|---|
sensor_msgs/NavSatFix |
latitude, longitude, altitude |
sensor_msgs/msg/NavSatFix |
(ROS 2 variant) |
foxglove.LocationFix |
latitude, longitude, altitude |
| GeoJSON | Feature / FeatureCollection geometry |
Performance Notes
FilteredPointLayeris the primary optimization — bounds rendering costFeatureGroupenables bulk add/remove (single DOM update)- Only the visible viewport bounds are processed
- Leaflet handles tile caching internally
- An upper bound on stored points prevents unbounded memory growth
Key Files
packages/suite-base/src/panels/Map/MapPanel.tsxpackages/suite-base/src/panels/Map/FilteredPointLayer.tspackages/suite-base/src/panels/Map/support.tspackages/suite-base/src/panels/Map/config.ts
Version History
- 6435710 Current 2026-08-16 02:35
- cab9317 2026-07-24 12:17


