1

I have a SQL server (2012) based data store in GeoServer (version 2.6) . For better readability I created a spatial layer with a whitespace in a column (attribute) name. enter image description here

Trying to use a style with the attribute "landslide code" reasults in an error.

org.geoserver.platform.ServiceException: The requested Style can not be used with this layer.  The style specifies an attribute of landslide code and the layer is some layername

The problem seems to be the whitespace in the attribute name. I tried to use the xml coding for whitespace , no success. I also tried to encapsulate the attribute name in square brackets [], which is the standard for sql server. Also no success.

How can I use attribute names with whitespaces in their names? SQL server allows this!

10
  • can you add the part of the sld that uses the property?
    – Ian Turton
    Jan 29, 2015 at 9:35
  • <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>landslide_ code</ogc:PropertyName> <ogc:Literal>3</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter>
    – Pemburu
    Jan 29, 2015 at 9:48
  • try with out _ <ogc:PropertyName>landslide code</ogc:PropertyName>
    – Ian Turton
    Jan 29, 2015 at 9:51
  • sorry, was a typo, without the underscore i get the same problem
    – Pemburu
    Jan 29, 2015 at 9:55
  • can you turn logging upto debug and look for the query
    – Ian Turton
    Jan 29, 2015 at 10:45

1 Answer 1

2

GeoServer is based on GeoTools and GeoTools is following the definition of "XML element name", so whitespaces are not allowed.

See the source: https://github.com/geotools/geotools/blob/284bb1273e47b02d6d5fca248732e2ab564e818e/modules/library/main/src/main/java/org/geotools/filter/expression/SimpleFeaturePropertyAccessorFactory.java#L83-L88

Your Answer

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

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