Reputation: 6080
I'm trying to draw a map with an API key from account A, then set a style created with account B.
I get a evented.js:92 Error: Forbidden(…)
, so I guess I can't "share" style to other API keys.
Is there a way to make a style "public" and usable by everyone ?
Upvotes: 2
Views: 1383
Reputation: 6080
In addition to mollymerp answer, here's a quick-n-dirty-n-partial solution:
// downloaded theme from mapbox studio
const style = { ... };
// delete useless keys
delete style.metadata;
delete style.created;
delete style.id;
delete style.modified;
delete style.owner;
delete style.draft;
// replace proprietary keys by public ones
style.sprite = 'mapbox://sprites/mapbox/streets-v9';
style.glyphs = 'mapbox://fonts/mapbox/{fontstack}/{range}.pbf';
It does work, but you will always have street-v9 icons, so it's not optimal with all colors, but there is no other easy way to do that.
I hope Mapbox will make a "public" option for our styles one day, so we can share them like snazzymaps.com
Upvotes: 0
Reputation: 1602
Unfortunately, there is not a way to make styles public at this time.
If you absolutely cannot use an access token from the same account as the style, you have the option of downloading the stylesheet from Mapbox Studio and then uploading it to the Studio account that created the access token you're using in the app. One caveat is you won't be able to access custom icons or font stacks.
Upvotes: 1