Search code examples
mapboxcartocss

How do I make the class 'path' show up at higher zoom levels using carto CSS in MapBox Studio?


I am working styling a map in MapBox studio. I am trying to make the road class path show up at a zoom level less than 14. As soon as I go to level 13 or less the paths all disappear. Does anyone know how to make the paths show up at levels 12 and 13?

I have tried this in my css.

  [class='path'] {

    ::path[zoom>=10]['mapnik::geometry_type'=2] {
      line-join: round;
      line-width: 1.0;
     }
  }

Solution

  • The mapbox-streets-v5 vector dataset that ships with Mapbox Studio only has certain vector data layers at each zoom level. The path data does not appear in this dataset at any zoom lower than 14, which is why you can't style it at any other zoom level.

    Fortunately, this data comes from OpenStreetMap, so you can add it as a custom source in Mapbox Studio and style it along with the other data! There is even a guide on grabbing this data from OpenStreetMap with Overpass Turbo.