Hi I would like to use an SLD file linked to a wms layer comming from a postgres query (using postgis).<br><br>In the SLD file I have rules that puts polygon colors according to an attribute in my table the attribute data can be equal to 1,2,3,4,5,6,7 or 8. and according to the value the polygon would be 1=red, 2=yellow, 1=blue etc.<br>
<br>I use a mapfile to retrieve the query:<br><br>Here is the layer part of the mapfile<br><br>&nbsp;LAYER<br>&nbsp;&nbsp;&nbsp; NAME &quot;buildings&quot;<br>&nbsp;&nbsp;&nbsp; TYPE POLYGON<br>&nbsp;&nbsp;&nbsp; STATUS OFF<br>&nbsp;&nbsp;&nbsp; CONNECTION &quot;dbname=... user=... password=... host=...&quot;<br>
&nbsp;&nbsp;&nbsp; CONNECTIONTYPE postgis<br>&nbsp;&nbsp;&nbsp; DATA &quot;the_geom_polygon from (select id_imm, max(the_geom_polygon) as the_geom_polygon, MAX(id_building_type) as color FROM imm_type group by id_imm) as t USING UNIQUE id_imm USING SRID = -1&quot;<br>
&nbsp;&nbsp;&nbsp; METADATA<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;wms_name&quot; &quot;buildings&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;wms_server_version&quot; &quot;1.1.0&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;wms_format&quot; &quot;image/png&quot;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;wms_exceptions_format&quot; &quot;application-vnd.ogc.se_inimage&quot;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;wms_transparent&quot; &quot;false&quot;<br>&nbsp;&nbsp;&nbsp; END<br>&nbsp;&nbsp;&nbsp; PROJECTION<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &quot;init=epsg:27582&quot;<br>&nbsp;&nbsp;&nbsp; END<br>END<br><br><br>Then I call this layer via a webservice with the link of the sld :<br>
<br><a href="http://www.mysite/wmsExportMap.php?REQUEST=GetMap&amp;VERSION=1.1.0&amp;SERVICE=WMS&amp;LAYERS=fond_wms,buildings&amp;SLD=http://www.mysite/sld/buildings.sld&amp;bbox=600477.507312,2424357.1016,605865.696562,2426763.76972&amp;width=450&amp;height=260">http://www.mysite/wmsExportMap.php?REQUEST=GetMap&amp;VERSION=1.1.0&amp;SERVICE=WMS&amp;LAYERS=fond_wms,buildings&amp;SLD=http://www.mysite/sld/buildings.sld&amp;bbox=600477.507312,2424357.1016,605865.696562,2426763.76972&amp;width=450&amp;height=260</a><br>
<br>in wmsExportMap.php I use $request = ms_newowsrequestobj(); to get a WMS map via a web service.<br><br>When I do this query I get the map I want except the the SLD does not work <br><br>the sld looks like :<br><br>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>
&lt;sld:StyledLayerDescriptor version=&quot;1.0.0&quot; xmlns:sld=&quot;<a href="http://www.opengis.net/sld">http://www.opengis.net/sld</a>&quot; xmlns:ogc=&quot;<a href="http://www.opengis.net/ogc">http://www.opengis.net/ogc</a>&quot; xmlns:gml=&quot;<a href="http://www.opengis.net/gml">http://www.opengis.net/gml</a>&quot; xmlns:xlink=&quot;<a href="http://www.w3.org/1999/xlink">http://www.w3.org/1999/xlink</a>&quot; xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>&quot; xsi:schemaLocation=&quot;<a href="http://www.opengis.net/sld">http://www.opengis.net/sld</a> <a href="http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd</a>&quot;&gt;<br>
&nbsp; &lt;sld:NamedLayer&gt;<br>&nbsp;&nbsp;&nbsp; &lt;sld:Name&gt;buildings&lt;/sld:Name&gt;<br>&nbsp;&nbsp;&nbsp; &lt;sld:UserStyle&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Name&gt;Default Styler&lt;/sld:Name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Title&gt;Default Styler&lt;/sld:Title&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Abstract/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:IsDefault&gt;1&lt;/sld:IsDefault&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:FeatureTypeStyle&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Name&gt;testStyleName&lt;/sld:Name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Title&gt;title&lt;/sld:Title&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Abstract&gt;abstract&lt;/sld:Abstract&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:FeatureTypeName&gt;Feature&lt;/sld:FeatureTypeName&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:SemanticTypeIdentifier&gt;generic:geometry&lt;/sld:SemanticTypeIdentifier&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Rule&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Name&gt;color1&lt;/sld:Name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Title&gt;title&lt;/sld:Title&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Abstract&gt;Abstract&lt;/sld:Abstract&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:Filter&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:PropertyIsEqualTo&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:PropertyName&gt;color&lt;/ogc:PropertyName&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:Literal&gt;1&lt;/ogc:Literal&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ogc:PropertyIsEqualTo&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ogc:Filter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:PolygonSymbolizer&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Fill&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:CssParameter name=&quot;fill&quot;&gt;#ff0f13&lt;/sld:CssParameter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sld:Fill&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sld:PolygonSymbolizer&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sld:Rule&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Rule&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Name&gt;color2&lt;/sld:Name&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Title&gt;title&lt;/sld:Title&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Abstract&gt;Abstract&lt;/sld:Abstract&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:Filter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:PropertyIsEqualTo&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:PropertyName&gt;color&lt;/ogc:PropertyName&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ogc:Literal&gt;2&lt;/ogc:Literal&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ogc:PropertyIsEqualTo&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/ogc:Filter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:PolygonSymbolizer&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Fill&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:CssParameter name=&quot;fill&quot;&gt;#ff9900&lt;/sld:CssParameter&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sld:Fill&gt;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sld:PolygonSymbolizer&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/sld:Rule&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sld:Rule&gt;<br>...<br><br><br><br>If I set no condition parameters in my sld, however it works fine (but then the buildings on my map are all of the same color) so I know the sld file is well linked to the WMS file. in addition, then I link with the above sld, I can see that postgres asks for the color field which is the propertyName I want to use, but still the buildings don&#39;t get the desired color.<br>
<br>Does someone have some problems like this? Is it possible to do this kink of things via mapserver?<br><br>Thanks in advance<br>