Hi list,
I noticed something strange when using variable substitution in
SLD<http://docs.geoserver.org/stable/en/user/styling/sld-extensions/substitution.html>
.

I verified this, with geoserver 2.3.1 and 2.5

I have a postgis layer with point and a a numeric attribute.

*THE LAYER*
the_geom: Point
thevalue: BigDecimal

I have created a SLD with an ogc:filter

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor (...)>
  <NamedLayer>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <ogc:Filter>
            <ogc:PropertyIsLessThan>
              <ogc:PropertyName>thevalue</ogc:PropertyName>
              *<ogc:Function name="env">*
*                <ogc:Literal>thevalue</ogc:Literal>*
*                <ogc:Literal>0</ogc:Literal>*
*            </ogc:Function>*
            </ogc:PropertyIsLessThan>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#FF0000</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Making a GetMap request with the extra param *&env=thevalue:50* I get this
error:

Caused by: org.postgresql.util.PSQLException: ERROR: invalid input syntax
for type numeric: "[50]"

In the output I found also this:
...
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting LogicFilter
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting PropertyName
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting LiteralExpression
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting SQL ComparisonFilter
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting PropertyName
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting LiteralExpression
10 Apr 11:24:42 DEBUG [geotools.filter] - exporting PropertyName
*10 Apr 11:24:42 DEBUG [geotools.jdbc] - SELECT (...) WHERE  (...) AND
"thevalue" <= '[50]' AND "thevalue" IS NOT NULL )*
10 Apr 11:24:42 DEBUG [geotools.jdbc] - CLOSE CONNECTION
10 Apr 11:24:42 ERROR [geotools.rendering] - java.io.IOException
java.lang.RuntimeException: java.io.IOException
at
org.geotools.data.store.ContentFeatureCollection.features(ContentFeatureCollection.java:168)
...


As a workaround I changed the SLD like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor (...)>
  <NamedLayer>
    <UserStyle>
      <FeatureTypeStyle>

        *<!-- RULE ADDED -->*
*        <Rule>*
*          <PointSymbolizer>*
*            <Graphic>*
*              <Mark>*
*                <WellKnownName>circle</WellKnownName>*
*                <Fill>*
*                  <CssParameter name="opacity">0</CssParameter>*
*                </Fill>*
*              </Mark>*
*              <Size>0</Size>*
*            </Graphic>*
*          </PointSymbolizer>*
*        </Rule>*

        <Rule>
          <ogc:Filter>
            <ogc:PropertyIsLessThan>
              <ogc:PropertyName>thevalue</ogc:PropertyName>
              <ogc:Function name="env">
                <ogc:Literal>thevalue</ogc:Literal>
                <ogc:Literal>0</ogc:Literal>
              </ogc:Function>
            </ogc:PropertyIsLessThan>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#FF0000</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

In this way request with or without the extra param works.
The same behavior happens if each OGC:Rule has an ogc:Filter.

Am I doing SLD styling wrong? Or this is not the GeoServer's intended
behavior?

Best regards

- Milan
------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to