postgisgeoserversld

Geoserver SLD Style - Space in propertyName


I'm trying to set up an sld style in Geoserver which references a column in a PostGIS view "Route Type". I'd like to have spaces in my column names as my goal is to create user friendly views for all my spatial data. With the sld below I get an error. I've tried a substituting the space for &nbsp; &#160; as well as <![CDATA[Property Name]]> None of these resolve the issue.

Is it possible to have spaces in propertyName?

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc"
 xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
 <NamedLayer>
   <Name>Truck Routes and Restrictions</Name>
   <UserStyle>
     <Title>Truck Routes and Restrictions</Title>
     <FeatureTypeStyle>
       <Rule>
         <Name>Designated Municipal Truck Route</Name>
         <ogc:Filter>
         <ogc:PropertyIsLike  wildCard="*" singleChar="." escape="!">
           <ogc:PropertyName>Route Type</ogc:PropertyName>
           <ogc:Literal>*Designated Municipal Truck Route*</ogc:Literal>
         </ogc:PropertyIsLike>
         </ogc:Filter>
         <LineSymbolizer>
        <Stroke>
          <CssParameter name="stroke">#006600</CssParameter>
          <CssParameter name="stroke-width">3</CssParameter>
        </Stroke>
      </LineSymbolizer>
       </Rule>
     </FeatureTypeStyle>
   </UserStyle>
 </NamedLayer>
</StyledLayerDescriptor>

Solution

  • As I read here PropertyName should be able to be retrieved by Web Feature Service. And next I read How to request WFS propertyName containing parentheses, where I read all this kind of elements must match XML element naming, which don't allows any spaces.

    So you can't use space in PropertyName. You should use "my column names" in way that will be not able to see for yours users.