I think I've run into a bug in how SLD rules are applied in geoserver. This is on GS 2.12.2 with the css styling extension. In my table I have units that I'd like to render with different icons and different colors based on a few attributes. I'm using red-blue-green cars-trucks-planes. I'd also like to show labels depending on zoom level. I'm testing this with cars only. Currently, when I'm zoomed out only red cars are being rendered, with no labels. The green and blue icons aren't being rendered until I zoom in past 20M, at which point the labels also show up. If I remove the '[@sd < 20M]' from the label rule, everything is shown as expected. I don't entirely understand the ordering in which sld rules are applied, but the fact that only some mark icons are being shown makes this feel like a bug. Let me know if you need any more info.
@mode "Flat";
/* @title Truck Red */
[status = 'A' OR status = 'B'] [vehicle_unit_detail_id IS NOT NULL] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Truck Green */
[status = 'C' OR status = 'D' OR status = 'E' OR status = 'F'] [vehicle_unit_detail_id IS NOT NULL] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Truck Blue */
[status <> 'A'] [status <> 'B'] [status <> 'C'] [status <> 'D'] [status <> 'E'] [status <> 'F'] [vehicle_unit_detail_id IS NOT NULL] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Car Red */
[status = 'A' OR status = 'B'] [vehicle_unit_detail_id IS NULL] [service = 'P'] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Car Green */
[status = 'C' OR status = 'D' OR status = 'E' OR status = 'F'] [vehicle_unit_detail_id IS NULL] [service = 'P'] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Car Blue */
[status <> 'A'] [status <> 'B'] [status <> 'C'] [status <> 'D'] [status <> 'E'] [status <> 'F'] [vehicle_unit_detail_id IS NULL] [service = 'P'] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Plane Red */
[status = 'A' OR status = 'B'] [service = 'N'] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Plane Green */
[status = 'C' OR status = 'D' OR status = 'E' OR status = 'F'] [service = 'N'] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
/* @title Plane Blue */
[status <> 'A'] [status <> 'B'] [status <> 'C'] [status <> 'D'] [status <> 'E'] [status <> 'F'] [service = 'N'] {
mark: url('http://localhost:8080/geoserver/www/styles/images/...');
}
[@sd < 20M] [@labels(true) = true] {
label: [vehicle_id], [location_name];
label-anchor: 1.5 0.5, 1.2 2;
font-family: "Trebuchet MS Bold";
font-fill: white;
font-style: normal;
font-size: 12;
halo-radius: 0.5;
halo-color: black;
}
EDIT1: I've tried moving the labeling rule into its own FeatureTypeStyle, but I got the same behavior.
EDIT2: I did a small test to see if the issue had something to do with location, but when I created 2 objects in the same location, the red car rendered when zoomed out and the blue one rendered over it when I zoomed in. Doesn't seem like a tiling/location issue.
EDIT3: Here's a pastebin of the generated sld if anyone wants to take a look. https://pastebin.com/cRgDDFGs