Uploaded image for project: 'GeoServer'
  1. GEOS-7768

Filter function "greaterEqualThan" is not properly working

    Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 2.9.1
    • Fix Version/s: 2.9.3, 2.10.0
    • Component/s: None
    • Labels:
      None
    • Environment:

      Amazon Linux (Linux 4.4.19-29.55.amzn1.x86_64 x86_64)
      Oracle JRE 1.8.0_74
      Tomcat 7.0.70

      Description

      Hi,
      I have been trying to style a layer using filter functions if_then_else and greaterEqualThan and have found that greaterEqualThan is behaving very strangely.

      To replicate the issue, I have created a simple SLD with the following TextSymbolizer whose labelling can be changed through variable substitution.

      <sld:TextSymbolizer>
        <sld:Label>
          <ogc:Function name="Concatenate">
            <ogc:Function name="greaterEqualThan">
              <ogc:Function name="env">
                <ogc:Literal>myvar</ogc:Literal>
                <ogc:Literal>0</ogc:Literal>
              </ogc:Function>
              <ogc:Literal>0</ogc:Literal>
            </ogc:Function>
            <ogc:Literal>:</ogc:Literal>
            <ogc:Function name="env">
              <ogc:Literal>myvar</ogc:Literal>
              <ogc:Literal>0</ogc:Literal>
            </ogc:Function>
          </ogc:Function>
        </sld:Label>
        <!-- Font, LabelPlacement as appropriate -->
      </sld:TextSymbolizer>
      

      I have applied the style to a simple shapefile and checked the labelling with different "myvar" values.

      The general finding was

      • greaterEqualThan determines 1 and 2 as ">= 0"
      • greaterEqualThan determines 0 and 3 to 9 as "< 0"
      • Negative numbers are determined as "< 0"
      • For numbers larger than 9, the results seem to be depending on the first (leftmost) digit. So
      • 10 - 29, 100 - 299 and 1000 - 2999 are determined as ">= 0"
      • 30 - 99, 300 - 999 and 3000 - 9999 are determined as "< 0"
      • The behaviour was the same with numbers with decimal places.
      • With double numbers fed from Postgres instead of variable substitute, the behaviour was the same
      • With numbers starting with zero, the behaviour was different
      • If the total character length was 2 or 3, the results were true
        eg. 00 - 09, 000 - 099 and 0.1 - 0.9 were ">= 0"
      • If the length was one or longer than 3, the results were always false
        eg. 0, 0000 - 0999 and 0.10 - 0.99 are "< 0"

      I have not tried different threadsholds or other siblings (greaterThan, lessThan and lessEqualThan) but I supect either the SLD parser or GeoTools is not evaluating numeric strings appropriately at least for this function.

      Kind regards,

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                GoSato Go Sato
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: