跳到主内容
智客 ZICQ

技能库 智客分类:Agent 工作流 mapbox-data-visualization-patterns

Mapbox Data Visualization Patterns

在地图上可视化数据的模式,包括相和图,热图,3D可视化,由数据驱动的造型,和动画数据. 覆盖层类型,颜色尺度,以及性能优化.

1787 安装量

官方网址:skills.sh

技能介绍

先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。

做什么

在地图上可视化数据的模式,包括相和图,热图,3D可视化,由数据驱动的造型,和动画数据. 覆盖层类型,颜色尺度,以及性能优化.

何时用

这个技能

代理如何加载

按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Data Visualization Patterns Skill、When to Use This Skill、Visualization Types、Choropleth Maps、Heat Maps、Best Practices。

文件分析

文件分析:除 SKILL.md 外,正文引用了 references/performance.md、references/clustering.md、references/3d-extrusions.md、references/circles-lines.md、references/animation.md,属于带资源的技能包,这些文件按需再读。

官方 description(原文)

Patterns for visualizing data on maps including choropleth maps, heat maps, 3D visualizations, data-driven styling, and animated data. Covers layer types, color scales, and performance optimization.

Data Visualization Patterns SkillWhen to Use This SkillVisualization TypesChoropleth MapsHeat MapsBest PracticesColor AccessibilityError HandlingData Size RuleReference FilesResources

来源分类:skills.sh agent-skill

SKILL.md 与 Agent 调用

官方规范 ↗
name
mapbox-data-visualization-patterns
description
Patterns for visualizing data on maps including choropleth maps, heat maps, 3D visualizations, data-driven styling, and animated data. Covers layer types, color scales, and performance optimization.
  1. 发现技能客户端向 Agent 提供名称与描述目录。
  2. 匹配与调用用户指定或任务匹配后,载入 SKILL.md 指令。
  3. 按需加载按步骤读取参考文档、使用脚本与素材。
指令中引用的文件 · 5
  • references/performance.md
  • references/clustering.md
  • references/3d-extrusions.md
  • references/circles-lines.md
  • references/animation.md

以下路径提取自原文;文件是否齐全请以来源仓库中的完整目录为准。

具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗

安装这个技能

Skills CLI ↗

先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。

该技能引用了附属文件,请从来源获取完整目录;仅复制 SKILL.md 可能缺少依赖。

交给 Agent 安装

复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。

把 Agent Skill「mapbox-data-visualization-patterns」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-0d9247185485d46e-%E6%98%A0%E5%B0%84%E7%9B%92%E6%95%B0%E6%8D%AE%E5%8F%AF%E8%A7%86%E5%8C%96-%E6%A8%A1%E5%BC%8F.html
请存为 .cursor/skills/mapbox-data-visualization-patterns/SKILL.md 或 .claude/skills/mapbox-data-visualization-patterns/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
该技能还带 scripts/、references/、assets/ 等文件,请从 https://github.com/mapbox/mapbox-agent-skills 取完整目录,不要只建一个 SKILL.md。

GitHub 完整包 ↗

终端安装 · Skills CLI

需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。

npx skills add 'https://github.com/mapbox/mapbox-agent-skills' --list

npx skills add 'https://github.com/mapbox/mapbox-agent-skills' --skill 'mapbox-data-visualization-patterns'

CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。

阅读排版
--- name: mapbox-data-visualization-patterns description: Patterns for visualizing data on maps including choropleth maps, heat maps, 3D visualizations, data-driven styling, and animated data. Covers layer types, color scales, and performance optimization. --- # Data Visualization Patterns Skill Comprehensive patterns for visualizing data on Mapbox maps. Covers choropleth maps, heat maps, 3D extrusions, data-driven styling, animated visualizations, and performance optimization for data-heavy applications. ## When to Use This Skill Use this skill when: - Visualizing statistical data on maps (population, sales, demographics) - Creating choropleth maps with color-coded regions - Building heat maps or clustering for density visualization - Adding 3D visualizations (building heights, terrain elevation) - Implementing data-driven styling based on properties - Animating time-series data - Working with large datasets that require optimization ## Visualization Types ### Choropleth Maps **Best for:** Regional data (states, counties, zip codes), statistical comparisons **Pattern:** Color-code polygons based on data values ```javascript map.on('load', () => { // Add data source (GeoJSON with properties) map.addSource('states', { type: 'geojson', data: 'https://example.com/states.geojson' // Features with population property }); // Add fill layer with data-driven color map.addLayer({ id: 'states-layer', type: 'fill', source: 'states', paint: { 'fill-color': [ 'interpolate', ['linear'], ['get', 'population'], 0, '#f0f9ff', // Light blue for low population 500000, '#7fcdff', 1000000, '#0080ff', 5000000, '#0040bf', // Dark blue for high population 10000000, '#001f5c' ], 'fill-opacity': 0.75 } }); // Add border layer map.addLayer({ id: 'states-border', type: 'line', source: 'states', paint: { 'line-color': '#ffffff', 'line-width': 1 } }); // Add hover effect with reusable popup const popup = new mapboxgl.Popup({ closeButton: false, closeOnClick: false }); map.on('mousemove', 'states-layer', (e) => { if (e.features.length > 0) { map.getCanvas().style.cursor = 'pointer'; const feature = e.features[0]; popup .setLngLat(e.lngLat) .setHTML( `

${feature.properties.name}

Population: ${feature.properties.population.toLocaleString()}

` ) .addTo(map); } }); map.on('mouseleave', 'states-layer', () => { map.getCanvas().style.cursor = ''; popup.remove(); }); }); ``` > **`step` vs `interpolate`:** The example above uses `interpolate` for smooth color gradients. For **discrete color buckets** (e.g., "low / medium / high"), use `['step', ['get', 'population'], '#f0f0f0', 500000, '#fee0d2', 2000000, '#fc9272', 10000000, '#de2d26']` instead. Prefer `step` when data has natural categories or when exact boundary values matter. **Color Scale Strategies:** ```javascript // Linear interpolation (continuous scale) 'fill-color': [ 'interpolate', ['linear'], ['get', 'value'], 0, '#ffffcc', 25, '#78c679', 50, '#31a354', 100, '#006837' ] // Step intervals (discrete buckets) 'fill-color': [ 'step', ['get', 'value'], '#ffffcc', // Default color 25, '#c7e9b4', 50, '#7fcdbb', 75, '#41b6c4', 100, '#2c7fb8' ] // Case-based (categorical data) 'fill-color': [ 'match', ['get', 'category'], 'residential', '#ffd700', 'commercial', '#ff6b6b', 'industrial', '#4ecdc4', 'park', '#45b7d1', '#cccccc' // Default ] ``` ### Heat Maps **Best for:** Point density, event locations, incident clustering **Pattern:** Visualize density of points ```javascript map.on('load', () => { // Add data source (points) map.addSource('incidents', { type: 'geojson', data: { type: 'FeatureCollection', features: [ { type: 'Feature', geometry: { type: 'Point', coordinates: [-122.4194, 37.7749] }, properties: { intensity: 1 } } // ... more points ] } }); // Add heatmap layer map.addLayer({ id: 'incidents-heat', type: 'heatmap', source: 'incidents', maxzoom: 15, paint: { // Increase weight based on intensity property 'heatmap-weight': ['interpolate', ['linear'], ['get', 'intensity'], 0, 0, 6, 1], // Increase intensity as zoom level increases 'heatmap-intensity': ['interpolate', ['linear'], ['zoom'], 0, 1, 15, 3], // Color ramp for heatmap 'heatmap-color': [ 'interpolate', ['linear'], ['heatmap-density'], 0, 'rgba(33,102,172,0)', 0.2, 'rgb(103,169,207)', 0.4, 'rgb(209,229,240)', 0.6, 'rgb(253,219,199)', 0.8, 'rgb(239,138,98)', 1, 'rgb(178,24,43)' ], // Adjust radius by zoom level 'heatmap-radius': ['interpolate', ['linear'], ['zoom'], 0, 2, 15, 20], // Decrease opacity at higher zoom levels 'heatmap-opacity': ['interpolate', ['linear'], ['zoom'], 7, 1, 15, 0] } }); // Add circle layer for individual points at high zoom map.addLayer({ id: 'incidents-point', type: 'circle', source: 'incidents', minzoom: 14, paint: { 'circle-radius': ['interpolate', ['linear'], ['zoom'], 14, 4, 22, 30], 'circle-color': '#ff4444', 'circle-opacity': 0.8, 'circle-stroke-color': '#fff', 'circle-stroke-width': 1 } }); }); ``` ## Best Practices ### Color Accessibility ```javascript // Use ColorBrewer scales for accessibility // https://colorbrewer2.org/ // Good: Sequential (single hue) const sequentialScale = ['#f0f9ff', '#bae4ff', '#7fcdff', '#0080ff', '#001f5c']; // Good: Diverging (two hues) const divergingScale = ['#d73027', '#fc8d59', '#fee08b', '#d9ef8b', '#91cf60', '#1a9850']; // Good: Qualitative (distinct categories) const qualitativeScale = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00']; // Avoid: Red-green for color-blind accessibility // Use: Blue-orange or purple-green instead ``` ### Error Handling ```javascript // Handle missing or invalid data map.on('load', () => { map.addSource('data', { type: 'geojson', data: dataUrl }); map.addLayer({ id: 'data-viz', type: 'fill', source: 'data', paint: { 'fill-color': [ 'case', ['has', 'value'], // Check if property exists ['interpolate', ['linear'], ['get', 'value'], 0, '#f0f0f0', 100, '#0080ff'], '#cccccc' // Default color for missing data ] } }); // Handle map errors map.on('error', (e) => { console.error('Map error:', e.error); }); }); ``` ## Data Size Rule - **< 1 MB**: Use GeoJSON directly - **1–10 MB**: Consider either GeoJSON or vector tiles depending on complexity - **> 10 MB**: Use vector tiles (upload to Mapbox as tileset) See [references/performance.md](references/performance.md) for implementation details. ## Reference Files For additional visualization patterns, load the relevant reference file: - **[references/clustering.md](references/clustering.md)** — Point clustering, custom cluster properties, clustering vs heatmap comparison - **[references/3d-extrusions.md](references/3d-extrusions.md)** — 3D building extrusions, custom data sources, data-driven heights - **[references/circles-lines.md](references/circles-lines.md)** — Circle/bubble maps, line data visualization, traffic flow styling - **[references/animation.md](references/animation.md)** — Time-series animation, real-time data updates, smooth transitions - **[references/performance.md](references/performance.md)** — Vector tiles vs GeoJSON, feature state, filtering, progressive loading - **[references/legends-use-cases.md](references/legends-use-cases.md)** — Legend UI, data inspector, data preprocessing, election/COVID/real-estate examples ## Resources - [Mapbox Expression Reference](https://docs.mapbox.com/style-spec/reference/expressions/) - [ColorBrewer](https://colorbrewer2.org/) - Color scales for maps - [Turf.js](https://turfjs.org/) - Spatial analysis - [Simple Statistics](https://simple-statistics.github.io/) - Data classification - [Data Visualization Tutorials](https://docs.mapbox.com/help/tutorials/#data-visualization)

相关技能

Agent 工作流

Skill Creator

创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.

Agent 工作流

Clawdhub

使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.

Agent 工作流

Agent Team Orchestration

管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.

Agent 工作流

Superpowers

Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…