[Geoserver-users] WMS & filters

All,

Here's a sample WMS request:

http://www.cei.psu.edu:8080/geoserver/wms?bbox=-229421.474121088,-1127546.08
271484,1899619.15966797,149878.297558592&request=GetMap&layers=cei:canada,ce
i:mexicarib,cei:ssa_48&width=800&height=480&styles=other_polygons,other_poly
gons,soil_polygons_white_opaque&format=image/png&srs=EPSG:102003&bgcolor=0x9
9ccff

I would like to use a filter on the top layer, 'ssa_48,' to bring back only
some of the features aacording to their ID. I would also eventually like to
apply an SLD on-the-fly to these features. Where in the URL string would I
place the filter or SLD? I eventually will use POST for this request, but
for now I would like to see it work via GET.

Many Thanks,
Steve

Stephen Crawford
Center for Environmental Informatics
GeoVISTA Center
The Pennsylvania State University
814.865.9905
src176@anonymised.com

I believe that I have a working example of a GetMap URL with a Filter to
bring back selected features and SLD for their symbolization. This
request has 3 layers - 2 are simple NamedLayer/NamedStyle (for road line
and road name, the third layer is NamedLayer/UserStyle, with the style
specified as CIRCLE, size 10, blue and the Filter as COMP_NUMBER=250111
(picks one point out of the datalayer). The URL gets kind of long and
messy, but it works. I found that I had to escape some things:

NOTE: With the SLD_BODY part of a GetMAP URL certain special characters
must be replaced.

%3A is a placeholder for :
%22 is a placeholder for "
%23 is a placeholder for # <-- this was critical, in the SLD color
area #0000FF became %230000FF

http://64.119.128.70/geoserver/wms?request=getmap&version=1.1.0&service=
wms&SLD_BODY=<StyledLayerDescriptor+version=%221.0.0%22+xmlns%3Agml=%22h
ttp://www.opengis.net/gml%22+xmlns%3Aogc=%22http://www.opengis.net/ogc%2
2+xmlns=%22http://www.opengis.net/sld%22><NamedLayer><Name>massgis:GISDA
TA.NAVTEQRDS_ARC</Name><NamedStyle><Name>GISDATA.NAVTEQRDS_ARC%3A%3ADefa
ult</Name></NamedStyle></NamedLayer><NamedLayer><Name>massgis:GISDATA.NA
VTEQRDS_ARC</Name><NamedStyle><Name>GISDATA.NAVTEQRDS_ARC%3A%3ALabels</N
ame></NamedStyle></NamedLayer><NamedLayer><Name>massgis:WELLS.WELLS_PT</
Name><UserStyle+xmlns=%22http://www.opengis.net/sld%22><FeatureTypeStyle

<Rule><Filter+xmlns=%22http://www.opengis.net/ogc%22><PropertyIsEqualTo
<PropertyName>COMP_NUMBER</PropertyName><Literal>250111</Literal></Prop

ertyIsEqualTo></Filter><PointSymbolizer><Geometry><PropertyName+xmlns=%2
2http://www.opengis.net/ogc%22>SHAPE</PropertyName></Geometry><Graphic><
Mark><WellKnownName>CIRCLE</WellKnownName><Fill><CssParameter+name=%22fi
ll%22>%230000FF</CssParameter></Fill></Mark><Size>10</Size></Graphic></P
ointSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></Styl
edLayerDescriptor>&bbox=204589,893552,204789,893752&format=image/png&wid
th=325&height=325&SRS=EPSG%3A26986

Aleda Freeman
MassGIS
Office of Geographic and Environmental Information
251 Causeway St. 5th floor
Boston, MA 02114
phone: 617-626-1193
fax: 617-626-1249
http://www.mass.gov/mgis - MassGIS
http://lyceum.massgis.state.ma.us - Webservices Wiki
http://maps.massgis.state.ma.us/biodiversity - EOEA Biodiversity Days