Community画像github.com

mapbox/mapbox-data-visualization-patterns

地図上でのデータ可視化パターン(コロプレスマップ、ヒートマップ、3D可視化、データ駆動型スタイリング、アニメーションデータ)を提供します。レイヤータイプ、色スケール、パフォーマンス最適化を網羅。

mapbox-data-visualization-patterns とは?

このスキルは、Mapbox GL JS を使用して地図上で高度なデータ可視化を実現するためのパターン集です。コロプレスマップ、ヒートマップ、3D可視化(押し出しや3Dモデル)、データ駆動型スタイリング、アニメーションなど、さまざまな可視化手法をカバーしています。レイヤータイプの選択、効果的な色スケールの適用、大規模データセットのパフォーマンス最適化に関する具体的なガイダンスを提供します。このスキルは、Mapbox GL JS を使用する開発者やデータサイエンティストにとって、インタラクティブで視覚的に魅力的な地図ベースのデータストーリーテリングを作成するための実践的なリファレンスです。各パターンは、サンプルコード、設定例、ベストプラクティスとともに説明されており、プロトタイプから本番環境への移行をスムーズにします。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mapbox/mapbox-agent-skills/tree/main/skills/mapbox-data-visualization-patterns

Installed? Explore more 画像 skills: steipete/songsee, affaan-m/frontend-design, mattpocock/improve-codebase-architecture · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

mapbox-data-visualization-patterns は何をしますか?

地図上でのデータ可視化パターン(コロプレスマップ、ヒートマップ、3D可視化、データ駆動型スタイリング、アニメーションデータ)を提供します。レイヤータイプ、色スケール、パフォーマンス最適化を網羅。

はじめに

このスキルでは、Mapbox GL JS を使用した一般的なデータ可視化テクニックを説明します。各パターンには、コード例とベストプラクティスが含まれています。

主な可視化パターン

  • コロプレスマップ: 地理的領域を色で区分けしてデータを表示します。fill レイヤーと fill-color プロパティを使用します。
  • ヒートマップ: 密度ベースの可視化により、点データの集中度を滑らかな色のグラデーションで表現します。heatmap レイヤーを使用します。
  • 3D可視化: 押し出し(fill-extrusion)や 3D モデル(model)を使用して、高さや奥行きのあるデータを表現します。
  • データ駆動型スタイリング: データの属性に基づいて色、不透明度、半径、高さなどを動的に変更します。
  • アニメーションデータ: 時間経過に伴う変化をアニメーションで表示します(例: フィルター式の切り替え、フィーチャーの遷移)。

レイヤータイプ

レイヤータイプ用途主なプロパティ
fillエリアデータ(コロプレスマップ)fill-color, fill-opacity
line線データ(道路、境界線)line-color, line-width
circle点データcircle-color, circle-radius
heatmap密度可視化heatmap-color, heatmap-radius
fill-extrusion3Dエクストルージョンfill-extrusion-color, fill-extrusion-height
symbolアイコン/ラベルicon-image, text-field

色スケール

連続データまたはカテゴリデータに適した色スケールを選択します。Mapbox GL JS では、step、interpolate、match 式を使用して色をマッピングできます。

  • 連続スケール: interpolate 式を使用して、数値範囲を滑らかな色のグラデーションにマッピングします。
  • 段階スケール: step 式を使用して、データを離散的な色のビンに分割します。
  • カテゴリスケール: match 式を使用して、カテゴリ値を特定の色に割り当てます。

パフォーマンス最適化

大規模データセットを扱う際のパフォーマンスを向上させるためのヒント:

  • 必要なタイルのみをレンダリングするために、minzoom と maxzoom を使用してレイヤーの可視範囲を制限します。
  • 高密度の点データには、cluster オプションを使用してクラスタリングを有効にします。
  • 複雑なスタイルの計算は、filter や paint プロパティ内で zoom 式を使用して、ズームレベルに応じて詳細度を調整します。
  • 不必要な再描画を避けるために、画像スプライトを使い、ベクトルタイルソースを活用します。

使用例

コロプレスマップの例

map.addLayer({
  'id': 'choropleth',
  'type': 'fill',
  'source': 'states',
  'paint': {
    'fill-color': [
      'interpolate',
      ['linear'],
      ['get', 'population_density'],
      0, '#F2F2F2',
      100, '#E3F2FD',
      1000, '#90CAF9',
      10000, '#1565C0'
    ],
    'fill-opacity': 0.8
  }
});

ヒートマップの例

map.addLayer({
  'id': 'heatmap',
  'type': 'heatmap',
  'source': 'points',
  'paint': {
    '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)'
    ],
    'heatmap-radius': 30,
    'heatmap-opacity': 0.8
  }
});

3Dエクストルージョンの例

map.addLayer({
  'id': '3d-buildings',
  'type': 'fill-extrusion',
  'source': 'buildings',
  'paint': {
    'fill-extrusion-color': [
      'interpolate',
      ['linear'],
      ['get', 'height'],
      0, '#F2F2F2',
      50, '#90CAF9',
      200, '#1565C0'
    ],
    'fill-extrusion-height': ['get', 'height'],
    'fill-extrusion-opacity': 0.6
  }
});

参考資料

Individual skills in this repo

This repo contains 8 individual skills — each has its own dedicated page.

mapbox/mapbox-cartography

Expert guidance on map design principles, color theory, visual hierarchy, typography, and cartographic best practices for creating effective and beautiful maps with Mapbox. Use when designing map styles, choosing colors, or making cartographic decisions.

mapbox/mapbox-geospatial-operations

Expert guidance on choosing the right geospatial tool based on problem type, accuracy requirements, and performance needs

mapbox/mapbox-search-integration

Complete workflow for implementing Mapbox search in applications - from discovery questions to production-ready integration with best practices

mapbox/mapbox-style-patterns

Common style patterns, layer configurations, and recipes for typical mapping scenarios including restaurant finders, real estate, data visualization, navigation, delivery/logistics, and more. Use when implementing specific map use cases or looking for proven style patterns.

mapbox/mapbox-style-quality

Expert guidance on validating, optimizing, and ensuring quality of Mapbox styles through validation, accessibility checks, and optimization. Use when preparing styles for production, debugging issues, or ensuring map quality standards.

mapbox/mapbox-token-security

Security best practices for Mapbox access tokens, including scope management, URL restrictions, rotation strategies, and protecting sensitive data. Use when creating, managing, or advising on Mapbox token security.

mapbox/mapbox-web-integration-patterns

Official integration patterns for Mapbox GL JS across popular web frameworks (React, Vue, Svelte, Angular). Covers setup, lifecycle management, token handling, search integration, and common pitfalls. Based on Mapbox's create-web-app scaffolding tool.

mapbox/mapbox-web-performance-patterns

Performance optimization patterns for Mapbox GL JS web applications. Covers initialization waterfalls, bundle size, rendering performance, memory management, and web optimization. Prioritized by impact on user experience.

関連スキル