Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

mapbox-maplibre-migrationMapbox Maplibre 迁移

Agent Skill

mapbox-maplibre-migration 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

10,551

周安装

431

GitHub Stars

47

下载量

3,379
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:mapbox-maplibre-migration(Mapbox Maplibre 迁移)
来源仓库:https://github.com/mapbox/mapbox-agent-skills
仓库路径:skills/mapbox-maplibre-migration
安装命令:
npx skills add https://github.com/mapbox/mapbox-agent-skills --skill mapbox-maplibre-migration
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/mapbox/mapbox-agent-skills --skill mapbox-maplibre-migration

简介

用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中快速定位候选结果。

  • 支持基于关键词、任务场景或来源线索进行信息检索与筛选。
  • 通过 npx skills add 命令从 GitHub 仓库安装使用。
  • 建议确认权限范围和维护状态,避免触发联网或文件读写操作。
  • mapbox-maplibre-migration 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

MapLibre to Mapbox Migration Skill

Expert guidance for migrating from MapLibre GL JS to Mapbox GL JS. Covers the shared history, API compatibility, migration steps, and the advantages of Mapbox's platform.

Understanding the Fork

History

MapLibre GL JS is an open-source fork of Mapbox GL JS v1.13.0, created in December 2020 when Mapbox changed their license starting with v2.0.

Timeline:

  • Pre-2020: Mapbox GL JS was open source (BSD license)
  • Dec 2020: Mapbox GL JS v2.0 introduced proprietary license
  • Dec 2020: Community forked v1.13 as MapLibre GL JS
  • Present: Both libraries continue active development

Key Insight: The APIs are ~95% identical because MapLibre started as a Mapbox fork. Most code works in both with minimal changes, making migration straightforward.

Why Migrate to Mapbox?

Compelling reasons to choose Mapbox GL JS:

  • Official Support & SLAs: Enterprise-grade support with guaranteed response times
  • Superior Tile Quality: Best-in-class vector tiles with global coverage and frequent updates
  • Better Satellite Imagery: High-resolution, up-to-date satellite and aerial imagery
  • Rich Ecosystem: Seamless integration with Mapbox Studio, APIs, and services
  • Advanced Features: Traffic-aware routing, turn-by-turn directions, premium datasets
  • Geocoding & Search: World-class address search and place lookup
  • Navigation SDK: Mobile navigation with real-time traffic
  • No Tile Infrastructure: No need to host or maintain your own tile servers
  • Regular Updates: Continuous improvements and new features
  • Professional Services: Access to Mapbox solutions team for complex projects

Mapbox offers a generous free tier: 50,000 map loads/month, making it suitable for many applications without cost.

Quick Comparison

AspectMapbox GL JSMapLibre GL JS
LicenseProprietary (v2+)BSD 3-Clause (Open Source)
SupportOfficial commercial supportCommunity support
TilesPremium Mapbox vector tilesOSM or custom tile sources
SatelliteHigh-quality global imageryRequires custom source
TokenRequired (access token)Optional (depends on tile source)
APIsFull Mapbox ecosystemRequires third-party services
StudioFull integrationNo native integration
3D TerrainBuilt-in with premium dataAvailable (requires data source)
Globe Viewv2.9+v3.0+
API Compatibility~95% compatible with MapLibre~95% compatible with Mapbox
Bundle Size~500KB~450KB
Setup ComplexityEasy (just add token)Requires tile source setup

Step-by-Step Migration

1. Create Mapbox Account

  1. Sign up at mapbox.com
  2. Get your access token from the account dashboard
  3. Review pricing: Free tier includes 50,000 map loads/month
  4. Note your token (starts with pk. for public tokens)

2. Update Package

# Remove MapLibre
npm uninstall maplibre-gl

# Install Mapbox
npm install mapbox-gl

3. Update Imports

// Before (MapLibre)
import maplibregl from 'maplibre-gl';
import 'maplibre-gl/dist/maplibre-gl.css';

// After (Mapbox)
import mapboxgl from 'mapbox-gl';
import 'mapbox-gl/dist/mapbox-gl.css';

Or with CDN:

<!-- Before (MapLibre) -->
<script src="https://unpkg.com/maplibre-gl@3.0.0/dist/maplibre-gl.js"></script>
<link href="https://unpkg.com/maplibre-gl@3.0.0/dist/maplibre-gl.css" rel="stylesheet" />

<!-- After (Mapbox) -->
<script src="https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.js"></script>
<link href="https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.css" rel="stylesheet" />

4. Add Access Token

// Add this before map initialization
mapboxgl.accessToken = 'pk.your_mapbox_access_token';

Token best practices:

  • Use environment variables: process.env.VITE_MAPBOX_TOKEN or process.env.NEXT_PUBLIC_MAPBOX_TOKEN
  • Add URL restrictions in Mapbox dashboard for security
  • Use public tokens (pk.*) for client-side code
  • Never commit tokens to git (add to .env and .gitignore)
  • Rotate tokens if compromised

See mapbox-token-security skill for comprehensive token security guidance.

5. Update Map Initialization

// Before (MapLibre)
const map = new maplibregl.Map({
  container: 'map',
  style: 'https://demotiles.maplibre.org/style.json', // or your custom style
  center: [-122.4194, 37.7749],
  zoom: 12
});

// After (Mapbox)
mapboxgl.accessToken = 'pk.your_mapbox_access_token';

const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/standard', // Mapbox style
  center: [-122.4194, 37.7749],
  zoom: 12
});

6. Update Style URL

Mapbox provides professionally designed, maintained styles:

// Mapbox built-in styles
style: 'mapbox://styles/mapbox/standard'; // Mapbox Standard (default)
style: 'mapbox://styles/mapbox/standard-satellite'; // Mapbox Standard Satellite
style: 'mapbox://styles/mapbox/streets-v12'; // Streets v12
style: 'mapbox://styles/mapbox/satellite-v9'; // Satellite imagery
style: 'mapbox://styles/mapbox/satellite-streets-v12'; // Hybrid
style: 'mapbox://styles/mapbox/outdoors-v12'; // Outdoor/recreation
style: 'mapbox://styles/mapbox/light-v11'; // Light theme
style: 'mapbox://styles/mapbox/dark-v11'; // Dark theme
style: 'mapbox://styles/mapbox/navigation-day-v1'; // Navigation (day)
style: 'mapbox://styles/mapbox/navigation-night-v1'; // Navigation (night)

Custom styles: You can also create and use custom styles from Mapbox Studio:

style: 'mapbox://styles/your-username/your-style-id';

7. Update All References

Replace all maplibregl references with mapboxgl:

// Markers
const marker = new mapboxgl.Marker() // was: maplibregl.Marker()
  .setLngLat([-122.4194, 37.7749])
  .setPopup(new mapboxgl.Popup().setText('San Francisco'))
  .addTo(map);

// Controls
map.addControl(new mapboxgl.NavigationControl(), 'top-right');
map.addControl(new mapboxgl.GeolocateControl());
map.addControl(new mapboxgl.FullscreenControl());
map.addControl(new mapboxgl.ScaleControl());

8. Update Plugins (If Used)

Some MapLibre plugins should be replaced with Mapbox versions:

MapLibre PluginMapbox Alternative
@maplibre/maplibre-gl-geocoder@mapbox/mapbox-gl-geocoder
@maplibre/maplibre-gl-draw@mapbox/mapbox-gl-draw
maplibre-gl-comparemapbox-gl-compare

Example:

// Before (MapLibre)
import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder';

// After (Mapbox)
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder';

map.addControl(
  new MapboxGeocoder({
    accessToken: mapboxgl.accessToken,
    mapboxgl: mapboxgl
  })
);

9. Everything Else Stays the Same

All your map code, events, layers, and sources work identically:

// This code works EXACTLY THE SAME in both libraries
map.on('load', () => {
  map.addSource('points', {
    type: 'geojson',
    data: geojsonData
  });

  map.addLayer({
    id: 'points-layer',
    type: 'circle',
    source: 'points',
    paint: {
      'circle-radius': 8,
      'circle-color': '#ff0000'
    }
  });
});

// Events work identically
map.on('click', 'points-layer', (e) => {
  console.log(e.features[0].properties);
});

// All map methods work the same
map.setCenter([lng, lat]);
map.setZoom(12);
map.fitBounds(bounds);
map.flyTo({ center: [lng, lat], zoom: 14 });

What Changes: Summary

Must change:

  • Package name (maplibre-gl -> mapbox-gl)
  • Import statements
  • Add mapboxgl.accessToken configuration
  • Style URL (switch to mapbox:// styles)
  • Plugin packages (if used)

Stays exactly the same:

  • All map methods (setCenter, setZoom, fitBounds, flyTo, etc.)
  • All event handling (map.on('click'), map.on('load'), etc.)
  • Marker/Popup APIs (100% compatible)
  • Layer/source APIs (100% compatible)
  • GeoJSON handling
  • Custom styling and expressions
  • Controls (Navigation, Geolocate, Scale, etc.)

Common Migration Issues

Issue 1: Token Not Set

Problem:

// Error: "A valid Mapbox access token is required to use Mapbox GL"
const map = new mapboxgl.Map({...});

Solution:

// Set token BEFORE creating map
mapboxgl.accessToken = 'pk.your_token';
const map = new mapboxgl.Map({...});

Issue 2: Token in Git

Problem:

// Token hardcoded in source
mapboxgl.accessToken = 'pk.eyJ1Ijoi...';

Solution:

// Use environment variables
mapboxgl.accessToken = process.env.VITE_MAPBOX_TOKEN;

// Add to .env file (not committed to git)
VITE_MAPBOX_TOKEN=pk.your_token

// Add .env to .gitignore
echo ".env" >> .gitignore

Issue 3: Wrong Style URL Format

Problem:

// MapLibre-style URL won't work optimally
style: 'https://demotiles.maplibre.org/style.json';

Solution:

// Use Mapbox style URL for better performance and features
style: 'mapbox://styles/mapbox/streets-v12';

Issue 4: Plugin Compatibility

Problem:

// MapLibre plugin won't work
import MaplibreGeocoder from '@maplibre/maplibre-gl-geocoder';

Solution:

// Use Mapbox plugin
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder';
Important: This applies to ALL MapLibre plugins, not just the geocoder. Any @maplibre/* or maplibre-gl-* plugin must be replaced with its Mapbox equivalent. Check the Mapbox ecosystem for Mapbox-specific versions of every plugin you use (see Step 8 above for the full mapping table).

Issue 5: CDN URLs

Problem:

// Wrong CDN
<script src="https://unpkg.com/maplibre-gl@3.0.0/dist/maplibre-gl.js"></script>

Solution:

// Use Mapbox CDN
<script src='https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.js'></script>
<link href='https://api.mapbox.com/mapbox-gl-js/v3.0.0/mapbox-gl.css' rel='stylesheet' />

Migration Checklist

  • Create Mapbox account and get access token
  • Update package: npm install mapbox-gl (remove maplibre-gl)
  • Update imports: maplibre-gl -> mapbox-gl
  • Update CSS imports: maplibre-gl.css -> mapbox-gl.css
  • Add token: Set mapboxgl.accessToken = 'pk.xxx'
  • Use environment variables: Store token in .env
  • Update style URL: Change to mapbox://styles/mapbox/streets-v12
  • Update all references: Replace maplibregl. with mapboxgl.
  • Update plugins: Install Mapbox versions of plugins (if used)
  • Configure token security: Add URL restrictions in dashboard
  • Test all functionality: Verify map loads, interactions work
  • Set up billing alerts: Monitor usage in Mapbox dashboard
  • Update documentation: Document token setup for team
  • Add.env to.gitignore: Ensure tokens not committed

Quick Reference

Key Differences Summary

WhatMapLibreMapbox
Packagemaplibre-glmapbox-gl
Importimport maplibregl from 'maplibre-gl'import mapboxgl from 'mapbox-gl'
TokenOptional (depends on tiles)Required: mapboxgl.accessToken = 'pk.xxx'
StyleCustom URL or OSM tilesmapbox://styles/mapbox/streets-v12
LicenseBSD (Open Source)Proprietary (v2+)
SupportCommunityOfficial commercial support
TilesRequires tile sourcePremium Mapbox tiles included
APIsThird-partyFull Mapbox API ecosystem
API~95% compatible~95% compatible

Bottom line: Migration is easy because APIs are nearly identical. Main changes are packaging, token setup, and style URLs. The result is access to Mapbox's premium tiles, ecosystem, and support.

Integration with Other Skills

Related skills:

  • mapbox-web-integration-patterns: Framework-specific patterns (React, Vue, Svelte, Angular)
  • mapbox-web-performance-patterns: Performance optimization techniques
  • mapbox-token-security: Comprehensive token security best practices
  • mapbox-google-maps-migration: Migrate from Google Maps to Mapbox

Resources

Mapbox GL JS:

Migration Support:

Reference Files

For detailed information on specific topics, load these reference files:

  • references/api-compatibility.md -- Full list of 100% compatible APIs + side-by-side migration example
  • references/exclusive-features.md -- Mapbox-exclusive features (APIs, Studio, Advanced) + React/Vue framework examples
  • references/why-mapbox.md -- Why Choose Mapbox (Production, Dev Teams, Business) + Performance Comparison

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.92%
按下载量换算1,146

Claude

29.04%
按下载量换算981

Cursor

19.96%
按下载量换算674

Gemini CLI

9.32%
按下载量换算315

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills