This might be related to ticket #4112. http://trac.osgeo.org/mapserver/ticket/4112
HÃ¥vard On 13/01/12 11:51, knut.landm...@ffi.no wrote:
Hi all, I want to do attribute dependent rendering using SLD with filters inside the <Rule> element, but cannot get it to work properly with MapServer 6.0.1 when the CONNECTIONTYPE is POSTGIS. However, all other things being equal, it works well with MapServer 5.2.1. It also works well with other data formats like GML or shape, in both versions of MapServer. Are there any changes in MapServer that I should be aware of that might affect how filters work? As an example, the attached figure1 shows the correct map generated by MS 5.2.1, while figure2 shows the MS 6.0.1 generated map in which all polygons get the same color. MS 6.0.1 uses the same PostGIS database and SLD file and an equivalent map file. In case it can provide any clues, my MS 5.2.1 generates SQL like this (from the log file): [Wed Jan 11 23:20:47 2012].319000 query_string_0_6:DECLARE mycursor BINARY CURSOR FOR SELECT "drval1"::text,"drval2"::text,asbinary(force_collection(force_2d(wkb_geometry)),'NDR'),ogc_fid::text from ukcbut00.depare WHERE wkb_geometry && setSRID('BOX3D(-1.57769913517149 50.6363909616681,-0.843360864828487 50.8899255935367)'::BOX3D, find_srid('','ukcbut00.depare','wkb_geometry') ) The select command fetches the two attributes drval1 and drval2, on which the filters act, as well as the geometry. However, MS 6.0.1 constructs SQL like this: [Wed Jan 11 22:22:06 2012].26000 msPostGISLayerWhichShapes query: select encode(ST_AsBinary(ST_Force_2D("wkb_geometry"),'NDR'),'hex') as geom,"ogc_fid" from ukcbut00.depare where wkb_geometry && GeomFromText('POLYGON((-1.57514202386 50.6588672768767,-1.57514202386 50.9035127337513,-0.841117976140038 50.9035127337513,-0.841117976140038 50.6588672768767,-1.57514202386 50.6588672768767))',find_srid('','ukcbut00.depare','wkb_geometry')) and (( ("drval1"<= 0) OR ("drval1"<= 10) OR ("drval1"<= 20) OR ("drval1">= 20) )) (The clause ("drval1"<= 0) OR ("drval1"<= 10) OR ("drval1"<= 20) OR ("drval1">= 20) seems a bit odd and is true for all polygons.) Below I have included the SLD code in its entirety. Thanks, Knut <?xml version="1.0" encoding="ISO-8859-1"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld" 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"> <NamedLayer> <Name>depare</Name> <UserStyle> <Title>AML Depth Area</Title> <FeatureTypeStyle> <Rule> <ogc:Filter> <ogc:PropertyIsLessThanOrEqualTo> <ogc:PropertyName>drval1</ogc:PropertyName> <ogc:Literal>0</ogc:Literal> </ogc:PropertyIsLessThanOrEqualTo> </ogc:Filter> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#B4EBFF</CssParameter> </Fill> </PolygonSymbolizer> </Rule> <Rule> <ogc:Filter> <And> <ogc:PropertyIsGreaterThanOrEqualTo> <ogc:PropertyName>drval1</ogc:PropertyName> <ogc:Literal>0</ogc:Literal> </ogc:PropertyIsGreaterThanOrEqualTo> <ogc:PropertyIsLessThanOrEqualTo> <ogc:PropertyName>drval2</ogc:PropertyName> <ogc:Literal>10</ogc:Literal> </ogc:PropertyIsLessThanOrEqualTo> </And> </ogc:Filter> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#66EBFF</CssParameter> <CssParameter name="fill-opacity">0.1</CssParameter> </Fill> </PolygonSymbolizer> </Rule> <Rule> <ogc:Filter> <And> <ogc:PropertyIsGreaterThanOrEqualTo> <ogc:PropertyName>drval1</ogc:PropertyName> <ogc:Literal>10</ogc:Literal> </ogc:PropertyIsGreaterThanOrEqualTo> <ogc:PropertyIsLessThanOrEqualTo> <ogc:PropertyName>drval2</ogc:PropertyName> <ogc:Literal>20</ogc:Literal> </ogc:PropertyIsLessThanOrEqualTo> </And> </ogc:Filter> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#0097FF</CssParameter> </Fill> </PolygonSymbolizer> </Rule> <Rule> <ogc:Filter> <ogc:PropertyIsGreaterThanOrEqualTo> <ogc:PropertyName>drval1</ogc:PropertyName> <ogc:Literal>20</ogc:Literal> </ogc:PropertyIsGreaterThanOrEqualTo> </ogc:Filter> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#2222FF</CssParameter> </Fill> </PolygonSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor> =
_______________________________________________ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users