I am trying to integrate mapbox maps/styles in HTML code. I succeeded in doing so using:

<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.14.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.14.1/mapbox-gl.css' rel='stylesheet' />

mapboxgl.accessToken = 'pk.eyJ1IjoibHB0ZXNzaWVyMTMiLCJhIjoiMEhrZUZaTSJ9.xU3ECSdq6K3LUkUuE8mZpQ';
var map = new mapboxgl.Map({
    container: 'map',
    style: 'mapbox://styles/lptessier13/cin5q5ilo00skctnfgeyrglfc',
    center: [6.08, 46.22],
    zoom: 11

Unfortunately, I cannot publish my maps/styles using the following:

<script src='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox.js/v2.1.5/mapbox.css' rel='stylesheet' />

L.mapbox.accessToken = 'pk.eyJ1IjoibHB0ZXNzaWVyMTMiLCJhIjoiMEhrZUZaTSJ9.xU3ECSdq6K3LUkUuE8mZpQ';
    var map = L.mapbox.map('map','mapbox://styles/lptessier13/cin5q5ilo00skctnfgeyrglfc')
        .setView([6.08, 46.22], 11);

I am not yet well versed in coding, but I thought that the problem may be residing in the API (mapbox-gl-js/v0.14.1 VS mapbox.js/v2.1.5)

If necessary, I could add the whole HTML file which is not very long.

1 Answer 1


In the bottom, you are trying to load a GL style with Leaflet, which uses tiled images, rather than GL styles.... For instance, change mapbox://styles... to mabox.streets and you'll have a basemap (with lat/long flipped), but then you will have to add your points in via L.geoJson().addTo(map) if you want to use mapbox.js over mapbox-gl.js.

  • Thank you very much for your help! If I could ask another question: are there any reasons why I should use one over the other? Apr 20, 2016 at 7:44
  • I would say its personal preference. However, Mapbox/Leaflet has a well established community and is thus far, much easier to develop. Whereas GL is still relatively new. I find myself reading their Github issues as much as their docs. But you can make superior (cartographically speaking) maps with GL. Here is a very good primer on GL: mapbox.com/help/mapbox-gl-js-fundamentals
    – CCantey
    Apr 20, 2016 at 14:54
  • Hi CCantey, Many thanks once again for your input and help. The webpage you referenced seems to have really useful information. Have a great day! Apr 22, 2016 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.