3

I have added a new SLD style for my nyc_roads layer but no map is displayed with the new style. I get the error "The requested Style can not be used with this layer. The style specifies an attribute of NAME and the layer is: wsNYCRoads:nyc_roads".

The named layer has already been named as suggested but still the same error appears. Why?

 <Name> wsNYCRoads:nyc_roads </Name>      
1
  • Thomas B. solution is the right approach, In my case, I change the code of the SLD file directly in Geoserver and it works. I changed the SLD file in a text editor before, then I imported to Geoserver, the results are quite strange: - the first change was right (ogc:PropertyName>name</ogc:PropertyName>), line 15 in my case - next changes were strange (ogc:PropertyName>-0099.00</ogc:PropertyName>), lines 37,59,89,103 and 125 For that reason, I found that made the changes in the Geoserver works fine, hope it could help
    – Albert JML
    May 8, 2021 at 0:44

1 Answer 1

10

I guess the attribute "NAME" is written in capital letters in your style and your column name of your layer/service is "name" without capital letters.could that be?

2
  • Thanks, I think you are pointing me into the right direction. Still couldn`t make it work though.This is where I found the "NAME" in the code: <Rule> <MaxScaleDenominator>32000</MaxScaleDenominator> <TextSymbolizer> <Label> <ogc:PropertyName>NAME</ogc:PropertyName> </Label> Even if I write my layer name here instead of NAME I get same type of error "The style specifies an attribute of wsNYCRoads:nyc_roads and the layer is: wsNYCRoads:nyc_roads".Tried with just layername and also as NAME="wsNYCRoads:nyc_roads".
    – nimetu
    Jan 23, 2015 at 22:45
  • 1
    <ogc:PropertyName>name</ogc:PropertyName>
    – Thomas B
    Jan 24, 2015 at 6:33

Your Answer

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

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