I am trying to create a generic style using CSS, so that I can have a set of styles which can be applied to polygons, lines and/or points. I am able to create the style:
- Add a new style...
- Format=CSS
- Generate a default style: "Generic", Generate... But when I apply it to a layer it comes back with the error message:
"The requested Style can not be used with this layer. The style specifies an attribute named 'geometry', not found in the 'My_Layer_Name' layer."
The CSS style generated is:
/* @title raster */
[isCoverage()=true] {
raster-channels: auto;
raster-opacity: 1.0;
}
/* @title red polygon */
[dimension(geometry)=2] {
stroke: #000000;
stroke-width: 0.5;
fill: #ff3300;
}
/* @title red line */
[dimension(geometry)=1] {
stroke: #ff3300;
}
/* @title red point */
[dimension(geometry)=0] {
mark: symbol(square);
mark-size: 6px;
:mark {
fill: #ff3300;
}
}
If I create a generic style based on SLD it works fine (as above, but setting Format=SLD), but CSS would be much easier to edit in order to create a whole bunch of new styles.
I am coming to the conclusion that CSS does not support being able to select between polygons, lines and points.
Geoserver version:2.20.2, running on Windows 10