Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mapbox-google-maps-migration

БесплатноБез исполняемых скриптовНе проверен

Migration guide for developers moving from Google Maps Platform to Mapbox GL JS, covering API equivalents, pattern translations, and key differences

mapboxот mapbox★ 90 звёзд на GitHub

Об этом скилле

Mapbox Google Maps Migration Skill

Comprehensive guidance for migrating from Google Maps Platform to Mapbox GL JS. Provides API equivalents, pattern translations, and strategies for successful migration.

Core Philosophy Differences

Google Maps: Imperative & Object-Oriented

  • Create objects (Marker, Polygon, etc.)
  • Add to map with .setMap(map)
  • Update properties with setters
  • Heavy reliance on object instances

Mapbox GL JS: Declarative & Data-Driven

  • Add data sources
  • Define layers (visual representation)
  • Style with JSON
  • Update data, not object properties

Key Insight: Mapbox treats everything as data + styling, not individual objects.

Map Initialization

Google Maps

const map = new google.maps.Map(document.getElementById('map'), {
  center: { lat: 37.7749, lng: -122.4194 },
  zoom: 12,
  mapTypeId: 'roadmap' // or 'satellite', 'hybrid', 'terrain'
});

Mapbox GL JS

mapboxgl.accessToken = 'YOUR_MAPBOX_TOKEN';
const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v12', // or satellite-v9, outdoors-v12
  center: [-122.4194, 37.7749], // [lng, lat] - note the order!
  zoom: 12
});

Key Differences:

  • Coordinate order: Google uses {lat, lng}, Mapbox uses [lng, lat]
  • Authentication: Google uses API key in script tag, Mapbox uses access token in code
  • Styling: Google uses map types, Mapbox uses full style URLs

API Equivalents Reference

Map Methods

Google Maps Mapbox GL JS Notes
map.setCenter(latLng) map.setCenter([lng, lat]) Coordinate order reversed
map.getCenter() map.getCenter() Returns LngLat object
map.setZoom(zoom) map.setZoom(zoom) Same behavior
map.getZoom() map.getZoom() Same behavior
map.panTo(latLng) map.panTo([lng, lat]) Animated pan
map.fitBounds(bounds) map.fitBounds([[lng,lat],[lng,lat]]) Different bound format
map.setMapTypeId(type) map.setStyle(styleUrl) Completely different approach
map.getBounds() map.getBounds() Similar

Map Events

Google Maps Mapbox GL JS Notes
google.maps.event.addListener(map, 'click', fn) map.on('click', fn) Simpler syntax
event.latLng event.lngLat Event property name
'center_changed' 'move' / 'moveend' Different event names
'zoom_changed' 'zoom' / 'zoomend' Different event names
'bounds_changed' 'moveend' No direct equivalent
'mousemove' 'mousemove' Same
'mouseout' 'mouseleave' Different name

Markers and Points

Simple Marker

Google Maps:

const marker = new google.maps.Marker({
  position: { lat: 37.7749, lng: -122.4194 },
  map: map,
  title: 'San Francisco',
  icon: 'custom-icon.png'
});

// Remove marker
marker.setMap(null);

Mapbox GL JS:

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

// Remove marker
marker.remove();

Multiple Markers

Google Maps:

const markers = locations.map(
  (loc) =>
    new google.maps.Marker({
      position: { lat: loc.lat, lng: loc.lng },
      map: map
    })
);

Mapbox GL JS (Equivalent Approach):

// Same object-oriented approach
const markers = locations.map((loc) => new mapboxgl.Marker().setLngLat([loc.lng, loc.lat]).addTo(map));

Mapbox GL JS (Data-Driven Approach - Recommended for 100+ points):

// Add as GeoJSON source + layer (uses WebGL, not DOM)
map.addSource('points', {
  type: 'geojson',
  data: {
    type: 'FeatureCollection',
    features: locations.map((loc) => ({
      type: 'Feature',
      geometry: { type: 'Point', coordinates: [loc.lng, loc.lat] },
      properties: { name: loc.name }
    }))
  }
});

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

**Performance Advant

Полный SKILL.md на GitHub

Установить mapbox-google-maps-migration в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

AGENTS.mdevals/evals.jsonreferences/api-services.mdreferences/clustering-styling.mdreferences/data-performance.mdreferences/directions-controls.mdreferences/shapes-geocoding.md

FAQ

Что делает скилл mapbox-google-maps-migration?

Migration guide for developers moving from Google Maps Platform to Mapbox GL JS, covering API equivalents, pattern translations, and key differences

Как установить скилл mapbox-google-maps-migration?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mapbox-google-maps-migration запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mapbox-google-maps-migration с