[Mapserver-users] SLD questions - How to filter
Kralidis,Tom [Burlington]
Tom.Kralidis at ec.gc.ca
Thu Feb 26 06:19:59 PST 2004
A couple of ideas:
1./
- have a 'service' i.e. some CGI script which dynamically generates an SLD
document based on your query, i.e.:
http://remote_server/cgi-bin/mapserv_41.exe?map=PATH/wms.map
&WMTVER=1.0.0
&REQUEST=map
&TRANSPARENT=TRUE
&SRS=EPSG:4326
&BBOX=50,0,170,40
&WIDTH=300
&HEIGHT=150
&FORMAT=PNG
&layers=boundaries
&sld=http%3A//remote_server/cgi-bin/makesld.exe%3FselectedCountry%3DChina
- use the SLD_BODY keyword to pass the entire SLD document (you might want
to use HTTP POST here :))
2./
- setup another mapfile with the SLD as per below as the template, and pass
that output as the SLD to the WMS
Hope this helps.
..Tom
=========================
Tom Kralidis
Systems Scientist
Environment Canada
Tel: +01-905-336-4409
http://www.ec.gc.ca/cise/
-----Original Message-----
From: Stefan Schwarzer [mailto:stefan.schwarzer at grid.unep.ch]
Sent: Thursday, February 26, 2004 2:42 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] SLD questions - How to filter
Dear list, dear Assefa,
I am trying to understand the functioning of the Styled Layer Descriptor and
am testing the 4.1 development version.
My "problem" (i.e. challenge) is the following: I would like to indicate a
country name within a WMS query, e.g. something like:
http://remote_server/cgi-bin/mapserv_41.exe?map=PATH/wms.map
&WMTVER=1.0.0
&REQUEST=map
&TRANSPARENT=TRUE
&SRS=EPSG:4326
&BBOX=50,0,170,40
&WIDTH=300
&HEIGHT=150
&FORMAT=PNG
&layers=boundaries
&selectedCountry=China
in order to receive something like the attached map (highlighting the
selected country).
As far as I understand I have to setup a SLD file... (I am not at all sure
about the correct use of the parameters!)
<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0">
<NamedLayer>
<Name>boundaries</Name>
<UserStyle>
<Filter>
<PropertyIsEqualTo>
<PropertyName>[CNTRY_NAME]</PropertyName>
<Literal>Thailand</Literal>
</PropertyIsEqualTo>
</Filter>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
and attach it to the URL...
&SLD=PATH/sld.xml
My .map file (resp. the layer) is looking like this:
LAYER
NAME boundaries
TYPE POLYGON
STATUS ON
DATA boundaries
CLASSITEM CNTRY_NAME
LABELITEM CNTRY_NAME
CLASS
#EXPRESSION ('[CNTRY_NAME]' eq 'China')
NAME 'boundaries'
#OUTLINECOLOR 0 0 0
TEMPLATE 'dummy'
LABEL
FONT arial-bold
TYPE truetype
ANTIALIAS true
SIZE 12
COLOR 248 255 43
OUTLINECOLOR 0 0 0
END
END
END
But in the moment it doesn't work. Can anybody give me some hints or
indicate the location of some examples?
Thanks a lot,
Stefan
_______________________________________
Stefan Schwarzer
Consultant on GEO
UNEP/DEWA/GRID-Geneva
Chemin des Anemones 11
CH - 1219 Chatelaine
Switzerland
Tel: (+41) 22.917.83.49
Fax: (+41) 22.917.80.29
Email: stefan.schwarzer at grid.unep.ch
Internet: http://geodata.grid.unep.ch/
_______________________________________
More information about the MapServer-users
mailing list