[Geoserver-users] Mulitple layers?

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=&Format=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=&Format=image/png&request=GetMap&layers=gbif:gbifDensityLayer&width=550&height=250&srs=EPSG:4326&FILTER=(type2id13140804</Filter

Layer 1 then 2: shows only layer 1
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:countries,gbif:gbifDensityLayer&width=550&height=250&srs=EPSG:4326&FILTER=(type2id13140804</Filter

Layer 2 then 1: shows only layer 1
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:gbifDensityLayer,gbif:countries&width=550&height=250&srs=EPSG:4326&FILTER=(type2id13140804</Filter

Any ideas?

Many thanks

Tim

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:

http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=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=&Format=image/png&request=GetMap&layers=gbif:gbifDensityLayer&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEqualTo><PropertyName>type</PropertyName><Literal>2</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>13140804</Literal></PropertyIsEqualTo></And></Filter <http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:gbifDensityLayer&width=550&height=250&srs=EPSG:4326&FILTER=(&lt;Filter&gt;&lt;And&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;type&lt;/PropertyName&gt;&lt;Literal&gt;2&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;id&lt;/PropertyName&gt;&lt;Literal&gt;13140804&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;/And&gt;&lt;/Filter&gt;&gt;\)
Layer 1 then 2: shows only layer 1
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:countries,gbif:gbifDensityLayer&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEqualTo><PropertyName>type</PropertyName><Literal>2</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>13140804</Literal></PropertyIsEqualTo></And></Filter <http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:countries,gbif:gbifDensityLayer&width=550&height=250&srs=EPSG:4326&FILTER=(&lt;Filter&gt;&lt;And&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;type&lt;/PropertyName&gt;&lt;Literal&gt;2&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;id&lt;/PropertyName&gt;&lt;Literal&gt;13140804&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;/And&gt;&lt;/Filter&gt;&gt;\)
Layer 2 then 1: shows only layer 1
http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:gbifDensityLayer,gbif:countries&width=550&height=250&srs=EPSG:4326&FILTER=(<Filter><And><PropertyIsEqualTo><PropertyName>type</PropertyName><Literal>2</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>id</PropertyName><Literal>13140804</Literal></PropertyIsEqualTo></And></Filter <http://localhost:8080/geoserver/wms?bbox=-180,-90,180,90&styles=&Format=image/png&request=GetMap&layers=gbif:gbifDensityLayer,gbif:countries&width=550&height=250&srs=EPSG:4326&FILTER=(&lt;Filter&gt;&lt;And&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;type&lt;/PropertyName&gt;&lt;Literal&gt;2&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;PropertyIsEqualTo&gt;&lt;PropertyName&gt;id&lt;/PropertyName&gt;&lt;Literal&gt;13140804&lt;/Literal&gt;&lt;/PropertyIsEqualTo&gt;&lt;/And&gt;&lt;/Filter&gt;&gt;\)
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

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

Tim Robertson ha scritto:

This mailing list is just awesome!
Where else can you get an answer so fast

Ah well, thank OpenPlans then, that is paying me for working
on GeoServer full time ("work" includes providing user assistance).

Cheers
Andrea

Thank you OpenPlans. What would we do without Andrea!

Dane

On Oct 18, 2007, at 7:08 AM, Andrea Aime wrote:

Tim Robertson ha scritto:

This mailing list is just awesome!
Where else can you get an answer so fast

Ah well, thank OpenPlans then, that is paying me for working
on GeoServer full time ("work" includes providing user assistance).

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users