Add custom map style to Mapbox.js

I just created my personal map style with Mapbox Studio and i'm try to use it with Mapbox.js. (NOT Mapbox Gl js!!) As written in the docu

You can load and display styles from the API using Mapbox GL JS or the Mapbox Mobile SDKs or you can request styles directly from the API. This request requires an access token with the styles:read scope.

I added on my < head > a link to:

I can see the JSON response but i still see basic map style.

How can i use my custom style in mapbox.js?



Sorry, but that won't work. Mapbox Styles are for use with Mapbox GL and the native iOS and Android SDK's. You can't use them with classic Mapbox JS. Mapbox JS supports raster tiles, you can't style those. They're just images. Mapbox GL and the native SDK's (can) use vector tiles and those are stylable. If you want to create a custom tileset for use with Mapbox JS you can do so using Mapbox Studio Classic.


You can use styles made with Mapbox Studio using the styleLayer method: Though, I'd highly recommend moving over to Mapbox GL JS when possible to leverage all the functionality of WebGL and vector tiles.


Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.