Skip to content

Mapbox migration guide

This part of the docs is dedicated to the migration from mapbox-gl to mapmetrics.

This guide might not be accurate depending on the current version of mapbox-gl but should be fairly straight forward.

The libraries are very similar but diverge with newer features happening from v2 in both libraries where Mapbox turned proprietary.

The overall migration happens by uninstalling mapbox-gl and installing mapmetrics in your node packages (or see below for CDN links), and replacing mapboxgl with mapmetrics throughout your TypeScript, JavaScript and HTML/CSS.

dif
-    var map = new mapboxgl.Map({
+    var map = new mapmetricsgl.Map({

-    <button class="mapboxgl-ctrl">
+    <button class="mapmetrics-ctrl">

Compatibility branch

Mapmetrics v1 is completely backward compatible with Mapbox GL JS v1. This compatibility branch (named 1.x) is tagged v1 on npm, and its current version is 1.15.3. We would recommend using MapMetrics for vector tiles.

Mapmetrics gives you custom links

dif
-  <script src="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.js"></script>
-  <link href="https://api.mapbox.com/mapbox-gl-js/v#.#.#/mapbox-gl.css" rel="stylesheet" />

+  <script src="https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.js"></script>
+  <link  href="https://cdn.mapmetrics-atlas.net/versions/latest/mapmetrics-gl.css" rel="stylesheet" />