I copied a mapbox style from github and want to use that to style a geoserver map. So I went to add the style but in the style preview tab I get this error:

The requested style cannot be used with this layer. The style specifies an attribute named 'class', not found in the 'workspace:line' layer

It says the same thing with ever every layer actually.

Classes are used for filtering stuff:

"filter": [
   ["in", "class", "primary", "secondary", "tertiary", "trunk"]

Is there an equivalent to class in GeoServer styling that I replace the classes with?

  • In and class look different from all the other things in your list. Are you sure that is right?
    – Ian Turton
    Commented Feb 27, 2022 at 16:58
  • @IanTurton Look the original mapbox style line 33 Commented Feb 27, 2022 at 17:09
  • 1
    The styles that you have are made to work with the OpenMapTiles schema openmaptiles.org/schema. OpenMapTiles do have attribute "class" but that is not any standard and GeoServer does not automatically create MVT tiles with the same attribute schema. The schema and MVT tiles must match. What attributes you do have in your workspace:line layer?
    – user30184
    Commented Feb 27, 2022 at 17:32
  • Uh, thank you. I don't know where to look for the attributes for the layer, I'll try to find them. Am I probably going to make a lot of changes to my styles? Commented Feb 27, 2022 at 17:44


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.