Mapbox classic styles

Hi Erin,

I’m getting emails saying that the Mapbox classic style I’m using (mapbox.outdoors) is being discontinued. What do I do to update so that leaflet uses the new style equivalent? Since it is being served up through the theme I’m a bit lost about where to start.

It’s far and away my favorite set of tiles, so I’d like to fix it if I can. I get the impression that I have to update the code to use a new API in leaflet?

All the best,
James

Hi @james-smith,

We updated the theme to work with the new Mapbox API, so you can log in to your Mapbox account, copy one of your map tokens at Account | Mapbox, and enter that in your theme settings.

Thanks Erin! I found the wording of the Mapbox email confusing. So I’ve gone into mapbox studio, created a new style based on Outdoor and gone to share, copied the token from studio styles and pasted that into Curatescape. It seems to be working, but that style isn’t on my tokens list so I’m not sure if I did it right.

Oh I see. It’s just giving me the public access token. Silly me.

Sorry @ebell but my Mapbox statistics are still saying that I’m still pulling in mapbox.outdoors rather than the modern style. I’m set to Outdoors on the Curatescape theme settings, but it still seems to be using the legacy style tiles. Have I missed something?

You might want to also check the settings for the Geolocation plugin (which may need an update to version 3.2+).

Okay I’ve updated the plugin to 3.2 and I’ve set my public key in the geolocation plugin and set the map ID to the new style ID. Is there anything else I need to look out for? The geolocation window in the item editor is using my new style, but the theme still seems to be drawing down the old tiles.

How long ago was the update to the new API made? I installed all this c. March this year - am I using an out of date theme?

This is going to be great because I have had lots of ideas for editing the style once it works!

Ok, it looks like I erred in describing how the updated tiles work in the Curatescape theme (and have since edited that part out of my comment above; I was thinking of changes made to the mobile app codebase, which also uses Mapbox). Your default public key will still be valid but you’ll only be able to use one of the available options listed in theme settings. These are the tilesets that are still available using the old method (outdoor, streets, light, dark, satellite, and satellite streets). At some point in the not-too-distant future, we’ll definitely update the theme to allow for custom Mapbox tilesets, so go ahead and create your custom style.

The current version of the theme is 3.4.1 (released June 1st)

Okay sounds like I should update the theme and use another tile set, then update again when you’ve enabled custom styles.

One last question since this is my first time updating a theme. What files should I save to keep my theme settings? I’m assuming config.ini, but I don’t want to miss anything else.

Thanks again so much for your help.

No need to save any of the old theme files. Your settings are stored in the Omeka database and will continue to work with the new version.

That said, it’s always a good idea to review and save the theme options after updating just in case anything has changed (though I think you’re probably fine if your last update was in March).

That’s good to know! Many thanks.

One more perhaps overly cautious question for you @ebell. I’ve made quite extensive bilingual modifications to custom.php and show-template-default.php. From what I can tell from my novice reading of the Github releases since I installed the theme you haven’t altered those files this year and I can just swap in my modified files, but I wanted to check for any hidden icebergs.

If you have customizations to preserve, I’d recommend setting up a clone of your current site where you can test updates.

While I may not have changed show-template-default.php, I probably made changes to other templates that get loaded there, such as custom.php, header.php, and footer.php. I think you’ll probably be fine, but it’s always a good idea to run your own tests.

I haven’t changed header.php or footer.php, but I’ve made custom.php quite different. It won’t break anything, it’s just more about the risk of undoing some of my displayed text changes.

I might wait until the updated theme using custom Mapbox styles is ready, and do it then. I have some non-deprecated maps that will do us fine until then. Now it has come up, that’s definitely the prize for me.

Edit: I tried updating the style and swapping out the files as a test, and it worked perfectly. I couldn’t get the new Outdoors option to load (greyed out desire correct key, I’ll try again next week), but we’re using Stamen terrain for now.

Although I’ve just noticed @ebell that the stamen tiles don’t work (greyed out) at the zoom level I need (worse for the mobile tiles). There’s a setting I can change to fix that right?

Depending on your coordinates, some tile sets may not work when zoomed all the way in (or in some cases, zoom levels higher than 18). For individual items, the zoom level you set on the backend will be reflected on the public item page. The global map and tour maps have theme settings to control the behavior (e.g. auto fit, default zoom, etc).

Just checking back in to say that after being on leave for a while I’ve gotten everything working very nicely, so thanks for answering my questions @ebell.