
Mapbox Google Maps Migration
Migrate Google Maps Platform UIs to Mapbox GL JS with coordinate swaps, layer patterns, and API equivalents for solo map features.
Overview
mapbox-google-maps-migration is an agent skill for the Build phase that maps Google Maps Platform APIs to Mapbox GL JS patterns for WebGL map UIs.
Install
npx skills add https://github.com/mapbox/mapbox-agent-skills --skill mapbox-google-maps-migrationWhat is this skill?
- Critical diff table: {lat,lng} objects vs [lng,lat] arrays and imperative Google vs declarative Mapbox layers
- 8-item quick migration checklist from mapbox-gl install through geocoding and regression testing
- Symbol layers for 100+ markers and clustering guidance for 500+ points vs slow Google DOM markers
- Side-by-side API equivalents for map init, markers, polylines, events, and geocoding
- Performance note: WebGL handles 10,000+ points vs Google struggling past ~500 markers
- Symbol layers recommended for 100+ markers; clustering for 500+ points
- Performance contrast cited: 10,000+ Mapbox points vs Google slowing past ~500 markers
Adoption & trust: 645 installs on skills.sh; 64 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your app still uses Google Maps but you need Mapbox performance, pricing, or styling—and agents keep emitting wrong coordinate order and DOM-marker patterns.
Who is it for?
Solo builders rewriting an existing google.maps.Map feature to mapbox-gl with 100+ markers or custom styles.
Skip if: Greenfield maps with no Google legacy, native-only Google Maps SDK apps without a web GL JS target, or server-only geospatial ETL.
When should I use this skill?
Replacing Google Maps Platform with Mapbox GL JS in an existing web map codebase.
What do I get? / Deliverables
Mapbox GL JS initialization, layers, clustering, and geocoding align with documented Google equivalents so you can test feature parity before ship.
- Mapbox-equivalent init, layers, and event handlers for former Google APIs
- Clustering and Symbol-layer strategy for target marker volume
Recommended Skills
Journey fit
Migration and SDK replacement happen while building the map experience, before Ship performance and Launch distribution work. Frontend subphase covers WebGL map init, markers vs Symbol layers, clustering, and geocoding client changes.
How it compares
Migration cheat sheet for two JS map SDKs—not a hosted tile server or Mapbox account provisioning skill.
Common Questions / FAQ
Who is mapbox-google-maps-migration for?
Indie developers and small teams shipping web map UIs who are switching off Google Maps Platform to Mapbox GL JS with agent assistance.
When should I use mapbox-google-maps-migration?
During Build frontend work when replacing google.maps APIs, before Ship perf validation of marker counts, or when Launch pages embed the new map widget.
Is mapbox-google-maps-migration safe to install?
It references installing mapbox-gl and using access tokens in client code—review secrets handling and the Security Audits panel on this Prism page.
SKILL.md
READMESKILL.md - Mapbox Google Maps Migration
# Google Maps to Mapbox GL JS Migration Guide Quick reference for migrating from Google Maps Platform to Mapbox GL JS with API equivalents and patterns. ## Critical Differences | Aspect | Google Maps | Mapbox GL JS | | ------------------ | ----------------------- | ------------------------- | | **Coordinates** | `{lat, lng}` objects | `[lng, lat]` arrays | | **Philosophy** | Imperative (objects) | Declarative (data-driven) | | **Rendering** | DOM elements | WebGL (much faster) | | **Performance** | Slow with 500+ markers | Fast with 10,000+ points | | **Initialization** | `new google.maps.Map()` | `new mapboxgl.Map()` | ## Quick Migration Checklist ✅ Install `mapbox-gl` package ✅ Get Mapbox access token ✅ Swap coordinate order (lat,lng → lng,lat) ✅ Replace Google Maps API with Mapbox equivalents ✅ Use Symbol layers for 100+ markers (not HTML markers) ✅ Add clustering for 500+ points ✅ Update geocoding to Mapbox Geocoding API ✅ Test all functionality ## API Equivalents ### Map Initialization ```javascript // Google Maps const map = new google.maps.Map(document.getElementById('map'), { center: { lat: 37.7749, lng: -122.4194 }, zoom: 12 }); // Mapbox GL JS mapboxgl.accessToken = 'pk.your_token'; const map = new mapboxgl.Map({ container: 'map', style: 'mapbox://styles/mapbox/streets-v12', center: [-122.4194, 37.7749], // Note: [lng, lat] zoom: 12 }); ``` ### Individual Markers (< 50 points) ```javascript // Google Maps const marker = new google.maps.Marker({ position: { lat: 37.7749, lng: -122.4194 }, map: map }); // Mapbox (equivalent approach) const marker = new mapboxgl.Marker().setLngLat([-122.4194, 37.7749]).addTo(map); ``` ### Many Markers (100+ points) - Performance Critical ```javascript // ❌ Google Maps: DOM-based (slow with 500+ markers) locations.forEach((loc) => { new google.maps.Marker({ position: { lat: loc.lat, lng: loc.lng }, map: map }); }); // ✅ Mapbox: WebGL-based (fast with 10,000+ points) map.addSource('points', { type: 'geojson', data: { type: 'FeatureCollection', features: locations.map((loc) => ({ type: 'Feature', geometry: { type: 'Point', coordinates: [loc.lng, loc.lat] } })) } }); map.addLayer({ id: 'points', type: 'symbol', source: 'points', layout: { 'icon-image': 'marker-15' } }); ``` **Performance Note:** Google Maps renders ALL markers as DOM elements (even with Data Layer). Mapbox uses WebGL for Symbol/Circle layers = 10-100x faster for large datasets. ### Clustering (500+ points) ```javascript // Google Maps (requires MarkerClusterer library) import MarkerClusterer from '@googlemaps/markerclustererplus'; const clusterer = new MarkerClusterer(map, markers); // Mapbox (built-in) map.addSource('points', { type: 'geojson', data: geojson, cluster: true, clusterRadius: 50 }); ``` ### Info Windows / Popups ```javascript // Google Maps const infowindow = new google.maps.InfoWindow({ content: '<h3>Title</h3>' }); infowindow.open(map, marker); // Mapbox const popup = new mapboxgl.Popup().setHTML('<h3>Title</h3>').setLngLat([-122.4194, 37.7749]).addTo(map); // Or attach to marker marker.setPopup(popup); ``` ### Events ```javascript // Google Maps marker.addListener('click', () => { /* ... */ }); map.addListener('click', (e) => { const lat = e.latLng.lat(); const lng = e.latLng.lng(); }); // Mapbox marker.on('click', () => { /* ... */ }); map.on('click', (e) => { const [lng, lat] = [e.lngLat.lng, e.lngLat.lat]; }); ``` ### Geocoding ```javascript // Google Maps const geocoder = new google.maps.Geocoder(); geocoder.geocode({ address: '1600 Amphitheatre Parkway' }, (results) => { map.setCenter(results[0].geometry.location); }); // Mapbox fetch( `https://api.mapbox.com/search/geocode/v6/forward?q=1600+Amphitheatre+Parkway&access_token=${mapboxgl.accessToken}` ) .then((r) => r.json()) .then((data) =