This mailing list is just awesome!
Where else can you get an answer so fast
I had tried 2 filters, but it was the space between the ( ) that I was
lacking Andrea
Many thanks
Tim
-----Original Message-----
From: Andrea Aime [mailto:aaime@anonymised.com]
Sent: Thursday, October 18, 2007 4:01 PM
To: Tim Robertson
Cc: 'geoserver users'
Subject: Re: [Geoserver-users] Mulitple layers?
Tim Robertson ha scritto:
Hi All,
I am trying to get mulitple layers on a single map with WMS, but am
failing. This is very much a newbie question, but I can't get it
working. Can someone see anything wrong here:
Layer 1 - works
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Forma
t=image/png&request=GetMap&layers=gbif:countries&width=550&height=250&
srs=EPSG:4326
<http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Form
at=image/png&request=GetMap&layers=gbif:countries&width=550&height=250
&srs=EPSG:4326>&
Layer 2 - works
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Forma
t=image/png&request=GetMap&layers=gbif:gbifDensityLayer&width=550&heig
ht=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEqualTo><Property
Name>type</PropertyName><Literal>2</Literal></PropertyIsEqualTo><Prope
rtyIsEqualTo><PropertyName>id</PropertyName><Literal>13140804</Literal
></PropertyIsEqualTo></And></Filter
<http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Form
at=image/png&request=GetMap&layers=gbif:gbifDensityLayer&width=550&hei
ght=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEqualTo><Propert
yName>type</PropertyName><Literal>2</Literal></PropertyIsEqualTo><Prop
ertyIsEqualTo><PropertyName>id</PropertyName><Literal>13140804</Litera
l></PropertyIsEqualTo></And></Filter>>)
Layer 1 then 2: shows only layer 1
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Forma
t=image/png&request=GetMap&layers=gbif:countries,gbif:gbifDensityLayer
&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEq
ualTo><PropertyName>type</PropertyName><Literal>2</Literal></PropertyI
sEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>13
140804</Literal></PropertyIsEqualTo></And></Filter
<http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Form
at=image/png&request=GetMap&layers=gbif:countries,gbif:gbifDensityLaye
r&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsE
qualTo><PropertyName>type</PropertyName><Literal>2</Literal></Property
IsEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>1
3140804</Literal></PropertyIsEqualTo></And></Filter>>)
Layer 2 then 1: shows only layer 1
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Forma
t=image/png&request=GetMap&layers=gbif:gbifDensityLayer,gbif:countries
&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEq
ualTo><PropertyName>type</PropertyName><Literal>2</Literal></PropertyI
sEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>13
140804</Literal></PropertyIsEqualTo></And></Filter
<http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Form
at=image/png&request=GetMap&layers=gbif:gbifDensityLayer,gbif:countrie
s&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsE
qualTo><PropertyName>type</PropertyName><Literal>2</Literal></Property
IsEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>1
3140804</Literal></PropertyIsEqualTo></And></Filter>>)
Any ideas?
When you specify one filter in the request it is applied to all layers, not
just the first, so I guess none of the features in layer2 has the attributes
the filter is looking for, or anyways if it has, the filter returns false on
those features.
I guess you may want to specify multiple filters like this:
&filter=(filter1)(filter2)
or if you don't want to filter on the second layer, use ( ) (with a space
between the parenthesis).
Let me know if this works for you
Cheers
Andrea