Convert CartoCSS to Mapbox GL Style - mapbox

I was trying to get an map style from the old Mapbox Studio Classic (https://www.mapbox.com/help/studio-classic-styles/) running in the new Mapbox Studio, i.e., converting it to Mapbox GL Style. I am wondering if there's a way to to convert at least the most part automatically?
Here's an example:
https://github.com/mapbox/mapbox-studio-winter-wonderland.tm2

Related

Mapbox linked to outside chart to show elevation

I am wondering if it's possible to do something like this with Mapbox GL:
https://raruto.github.io/leaflet-elevation/examples/leaflet-elevation_geojson-data.html
I would like to have interaction between a chart and Mapbox by moving the marker either on the chart or either on the map.
I googled for this but i didn't find anything for Mapbox GL, just for Leaflet.
Currently i'm using Chart.js and Mapbox and i don't see how to manage to reproduce the above example.
Any hints maybe?
Thanks a lot
I can confirm for you that it is possible to build something like this using Mapbox GL JS.

Mapbox Outdoors - Background and Labels of Old Style with Mapbox Studio

I've been working with a leaflet map using the mapbox outdoors raster tile server. Mapbox has a handful of ready-made styles, most of which are listed in this answer. The code / url for this is like so:
var mapBoxOutdoorsClassic = L.tileLayer('https://api.tiles.mapbox.com/v4/mapbox.outdoors/{z}/{x}/{y}.png?access_token={accessToken}', {
accessToken: '...',
attribution: '...',
maxZoom: 18,
}).addTo(map1);
I love this style. But my issue is that I'm trying to add an imageoverly. I want the imageoverlay to be above the map terrain graphics, but under the labels. So what I did was go into mapbox studio and create these two styles - basically the outdoors style, with the labels separated out:
Without Labels
Labels Only
Here's a codesandbox comparing the raster and mapbox studio styles
The old style is on the left, the new styles with the separated out layers is on the right. You can play with the layers in the upper right corner.
So separating the layers out has worked well, as you can see in the codesandbox. But the styles from the raster tiles are not really the same as the ones from mapbox studio! I'm guessing the raster tiles are from a few years ago, and the styles have been updated since. But I really like the older style - it has more of a colored pencil feel to it, more of a national parks map style, as opposed to the new style which has more of an OSM or google maps feel. Rather than spend hours in mapbox studio trying to recreate the old style, does anyone know if these styles exist somewhere within mapbox studio? Perhaps a 'mapbox outdoors classic'? I really just want the exact styles are show in the map on the left in my codesandbox, but with the ability to separate the labels layer from the rest.
With Mapbox Studio style components, it's actually pretty quick to recreate older Mapbox styles in the modern Mapbox Studio. In fact, here's a five minute video from Mapbox showing how to recreate the classic Mapbox Outdoors in modern Studio!
How to update a classic style in modern Mapbox Studio

Display maki icons on markers according to geojson feature property

in the past, I created my maps on the Mapbox website and embedded them on my Jekyll blog using an iframe. Now, I developed a jekyll plugin that consumes a geojson file and employs Mapbox GL JS to display maps.
I would like to support Maki icons for indvidual marker using GeoJSON feature properties using the SimpleStyle Spec
How can reproduce the following map with features including marker symbols defined in GeoJSON?
Current Mapbox code for Jekyll Maps: on Github
Related question:
for Mapbox.js (Leaflet): Mapbox - Custom marker icons from GeoJson properties
for Mapbox GL JS: Maki icons not all displaying

Can I get the CartoCSS from a mapbox map?

Say I'm linking to a map made by someone else kitsunde.foo-bar-foo, is it possible for me to discover what CartoCSS was involved in rendering it?
Nope! CartoCSS is a pre-processor for Mapnik XML styling. When you upload a style to Mapbox from Mapbox Studio Classic, the CartoCSS is converted to Mapnik XML, and by the time it's actually in the browser, it's been combined with the vector sources and rendered into a static image. The CartoCSS is never stored on Mapbox's end.

Mapbox Studio - Changing appearance of live map

I've been using MapBox studio for a few weeks now but I'm curious, using the API is it possible to change the look of a map using html UI elements? For example, if I want to have a slider on the page which is displaying my map which adjusts the size of the POI labels, is it possible to do that, or am I beholden to the current saved .mss file for those attributes?
Mapbox Studio is designed for the rendering of raster tiles and not for live-changing styles. Check out Mapbox GL for preview of how live styling will work.