I have shapefile with 5 features with an integer attribute - DAMAMGE). 
Each of these features as a unique DAMAGE value between 1 and 5.  In 
uDig I'm creating a color-theming style that creates 5 rules that are 
similar to the SLD below.  These rules basically evaluate the statement 
"1 <= DAMAGE < 1.8";

When I view the results in uDig, the colors are incorrect as the 
features are being put in the wrong categories.  From my debugging it 
looks like that when the filter is evaluating, the "1.8" is being 
converted to the Integer "1" thus evaluating the expression "1 <= DAMAGE 
< 1" which is always going to return false.

This conversion from 1.8 to 1 is being done in the eval function of the 
BinaryComparisonAbstract class.  Here it converts the "1.8" double to an 
integer.

I'm wondering how/if this can be fixed?  (or maybe it's designed to work 
this way?)

I was thinking of trying to add some logic to this function to be 
smarter about the conversion done & try to not loose precision if 
possible (for example convert from integer to double before we convert 
from double to integer).   I'm not sure if this is the best way to go 
about this?

Thanks,
Emily


<sld:Rule>
  <sld:Name>rule01</sld:Name>
  <sld:Title>1..1.8</sld:Title>
  <ogc:Filter>
      <ogc:And>
          <ogc:PropertyIsGreaterThanOrEqualTo>
              <ogc:PropertyName>Damage</ogc:PropertyName>
              <ogc:Literal>1</ogc:Literal>
          </ogc:PropertyIsGreaterThanOrEqualTo>
          <ogc:PropertyIsLessThan>
              <ogc:PropertyName>Damage</ogc:PropertyName>
              <ogc:Literal>1.8</ogc:Literal>
          </ogc:PropertyIsLessThan>
      </ogc:And>
  </ogc:Filter>
  <sld:MaxScaleDenominator>1.7976931348623157E308</sld:MaxScaleDenominator>
  <sld:PolygonSymbolizer>
      <sld:Fill>
          <sld:CssParameter name="fill">
              <ogc:Literal>#EFF3FF</ogc:Literal>
          </sld:CssParameter>
          <sld:CssParameter name="fill-opacity">
              <ogc:Literal>0.5</ogc:Literal>
          </sld:CssParameter>
      </sld:Fill>
      <sld:Stroke>
          <sld:CssParameter name="stroke">
              <ogc:Literal>#000000</ogc:Literal>
          </sld:CssParameter>
          <sld:CssParameter name="stroke-linecap">
              <ogc:Literal>butt</ogc:Literal>
          </sld:CssParameter>
          <sld:CssParameter name="stroke-linejoin">
              <ogc:Literal>miter</ogc:Literal>
          </sld:CssParameter>
          <sld:CssParameter name="stroke-opacity">
              <ogc:Literal>1</ogc:Literal>
          </sld:CssParameter>
          <sld:CssParameter name="stroke-width">
              <ogc:Literal>1</ogc:Literal>
          </sld:CssParameter>
          <sld:CssParameter name="stroke-dashoffset">
              <ogc:Literal>0</ogc:Literal>
          </sld:CssParameter>
      </sld:Stroke>
  </sld:PolygonSymbolizer>
<sld:Rule>

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to