0

According to the docs:

Filtering on Type¶

When dealing with data from multiple sources, it may be useful to provide rules that only affect one of those sources. This is done very simply; just specify the name of the layer as a filter:

states { stroke: black; }

So I created this style:

points [@scale > 5000000] ['state' = place] {
    label: [name];
}

And got this error:

The requested Style can not be used with this layer. The style specifies an attribute of place and the layer is: cite:lines

My reading of the docs is that only features from the "points" layer should be considered, but my reading of the error message is a "lines" feature was used and found to not have a 'place' attribute. Am I misunderstanding the syntax?

On a side note, my entire css file is 3KB and the generated sld file is 55KB and the generated SLD looks correct:

    <sld:FeatureTypeName>points</sld:FeatureTypeName>
    <sld:Rule>
      <ogc:Filter>
        <ogc:PropertyIsEqualTo>
          <ogc:Literal>state</ogc:Literal>
          <ogc:PropertyName>place</ogc:PropertyName>
        </ogc:PropertyIsEqualTo>
      </ogc:Filter>
2

I believe this has little to do with CSS per se, it's just that the attribute checking happens before the FTS are selected out and it's not even considering that the rule would not actually apply to the layer. You can open a ticket at https://osgeo-org.atlassian.net/projects/GEOS/summary, and even better if you can, make a pull request to fix the issue, see contribution rules here https://github.com/geoserver/geoserver/blob/master/CONTRIBUTING.md

Generally speaking, regardless of the styling language you choose, support for styles targeting multiple layers at once is theoretical/untested, most people just build one style per layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.