Adrien
You should be able to use the sld with filter. Looking at your sld,
you should end up with several classes where the expressions in each
class should be set to something like EXPRESSION ([color] = 1),
EXPRESSION ([color] = 2). Would these expressions be valid in your case
(with your data)?
As a note, you can also check
http://trac.osgeo.org/mapserver/ticket/2573 and
http://trac.osgeo.org/mapserver/ticket/2635 that might give you hints on
what is going on.
Y.A.
Adrien Ducos wrote:
Hi I would like to use an SLD file linked to a wms layer comming from a
postgres query (using postgis).
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.
I use a mapfile to retrieve the query:
Here is the layer part of the mapfile
LAYER
NAME "buildings"
TYPE POLYGON
STATUS OFF
CONNECTION "dbname=... user=... password=... host=..."
CONNECTIONTYPE postgis
DATA "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"
METADATA
"wms_name" "buildings"
"wms_server_version" "1.1.0"
"wms_format" "image/png"
"wms_exceptions_format" "application-vnd.ogc.se_inimage"
"wms_transparent" "false"
END
PROJECTION
"init=epsg:27582"
END
END
Then I call this layer via a webservice with the link of the sld :
http://www.mysite/wmsExportMap.php?REQUEST=GetMap&VERSION=1.1.0&SERVICE=WMS&LAYERS=fond_wms,buildings&SLD=http://www.mysite/sld/buildings.sld&bbox=600477.507312,2424357.1016,605865.696562,2426763.76972&width=450&height=260
<http://www.mysite/wmsExportMap.php?REQUEST=GetMap&VERSION=1.1.0&SERVICE=WMS&LAYERS=fond_wms,buildings&SLD=http://www.mysite/sld/buildings.sld&bbox=600477.507312,2424357.1016,605865.696562,2426763.76972&width=450&height=260>
in wmsExportMap.php I use $request = ms_newowsrequestobj(); to get a WMS
map via a web service.
When I do this query I get the map I want except the the SLD does not work
the sld looks like :
<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor version="1.0.0"
xmlns:sld="http://www.opengis.net/sld"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<sld:NamedLayer>
<sld:Name>buildings</sld:Name>
<sld:UserStyle>
<sld:Name>Default Styler</sld:Name>
<sld:Title>Default Styler</sld:Title>
<sld:Abstract/>
<sld:IsDefault>1</sld:IsDefault>
<sld:FeatureTypeStyle>
<sld:Name>testStyleName</sld:Name>
<sld:Title>title</sld:Title>
<sld:Abstract>abstract</sld:Abstract>
<sld:FeatureTypeName>Feature</sld:FeatureTypeName>
<sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier>
<sld:Rule>
<sld:Name>color1</sld:Name>
<sld:Title>title</sld:Title>
<sld:Abstract>Abstract</sld:Abstract>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>color</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#ff0f13</sld:CssParameter>
</sld:Fill>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<sld:Name>color2</sld:Name>
<sld:Title>title</sld:Title>
<sld:Abstract>Abstract</sld:Abstract>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>color</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#ff9900</sld:CssParameter>
</sld:Fill>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
...
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't get the
desired color.
Does someone have some problems like this? Is it possible to do this
kink of things via mapserver?
Thanks in advance
------------------------------------------------------------------------
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users
--
----------------------------------------------------------------
Assefa Yewondwossen
Software Analyst
Email: [EMAIL PROTECTED]
http://www.dmsolutions.ca/
Phone: (613) 565-5056 (ext 14)
Fax: (613) 565-0925
----------------------------------------------------------------
_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users