I have been trying to figure out how to use a CQL_FILTER parameter in a WMS
request that returns more than one layer. Is there a way to control which
layer the filter affects, or does it always get applied to all the layers in
the WMS request?
For example, the following request gives reasonable results, but only
because the POI names and road names are unique. Is there a way to specify
that the (NAME='church') filter applies to the POI, and that the
(NAME='Brooklyn Battery Tunl') applies to the roads layer?
http://localhost:8080/geoserver/wms?bbox=-74.047185,40.679648,-73.907005,40.882078&styles=&Format=image/png&request=GetMap&width=457&height=550&srs=EPSG:4326
&layers=tiger:tiger_roads,tiger:poi
&CQL_FILTER=(NAME='Brooklyn Battery Tunl')OR(NAME='church')
And if you can't do this with the CQL_FILTER parameter, is there another way
to do it?
- Tyler
--
View this message in context: http://www.nabble.com/How-to-filter-specific-layers-with-CQL_FILTER--tp15641876p15641876.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Tyler Erickson ha scritto:
I have been trying to figure out how to use a CQL_FILTER parameter in a WMS
request that returns more than one layer. Is there a way to control which
layer the filter affects, or does it always get applied to all the layers in
the WMS request?
For example, the following request gives reasonable results, but only
because the POI names and road names are unique. Is there a way to specify
that the (NAME='church') filter applies to the POI, and that the
(NAME='Brooklyn Battery Tunl') applies to the roads layer?
http://localhost:8080/geoserver/wms?bbox=-74.047185,40.679648,-73.907005,40.882078&styles=&Format=image/png&request=GetMap&width=457&height=550&srs=EPSG:4326
&layers=tiger:tiger_roads,tiger:poi
&CQL_FILTER=(NAME='Brooklyn Battery Tunl')OR(NAME='church')
And if you can't do this with the CQL_FILTER parameter, is there another way
to do it?
It's possible. I've tried to extend the wiki page to include this information (http://geoserver.org/display/GEOSDOC/WMS+vendor+parameters), anyways, the short version is that you can specify multiple filters by separating
them by ";".
If you specify just one filter, it'll be applied to all layers, otherwise you can make up a list of filters, one per layer.
Cheers
Andrea
How would you write the cql_filter if you wanted to filter the records of one layer and return all the records of another layer? I tried ending the filter with a semi-colon, i.e.
&cql_Filter=LANAME%20=%20%22East%20River%22;
but I received an WMS error saying it could not parse cql_filter list. I am able to get it working using a dummy filter:
&cql_Filter=LANAME%20=%20%22East%20River%22;NAME<>%22DUMMY%22
but that seems pretty inelegant.
Also (out of curiosity), why use the semicolon as the list delimiter instead of the comma delimiter that is used by the layers and styles parameters?
- Tyler
Andrea Aime wrote:
Tyler Erickson ha scritto:
I have been trying to figure out how to use a CQL_FILTER parameter in a WMS
request that returns more than one layer. Is there a way to control which
layer the filter affects, or does it always get applied to all the layers in
the WMS request?
For example, the following request gives reasonable results, but only
because the POI names and road names are unique. Is there a way to specify
that the (NAME='church') filter applies to the POI, and that the
(NAME='Brooklyn Battery Tunl') applies to the roads layer?
http://localhost:8080/geoserver/wms?bbox=-74.047185,40.679648,-73.907005,40.882078&styles=&Format=image/png&request=GetMap&width=457&height=550&srs=EPSG:4326
&layers=tiger:tiger_roads,tiger:poi
&CQL_FILTER=(NAME='Brooklyn Battery Tunl')OR(NAME='church')
And if you can't do this with the CQL_FILTER parameter, is there another way
to do it?
It's possible. I've tried to extend the wiki page to include this information (http://geoserver.org/display/GEOSDOC/WMS+vendor+parameters), anyways, the short version is that you can specify multiple filters by separating
them by ";".
If you specify just one filter, it'll be applied to all layers, otherwise you can make up a list of filters, one per layer.
Cheers
Andrea
--
Tyler A. Erickson, Ph.D.
Research Scientist
Michigan Tech Research Institute
3600 Green Court, Suite 100
Ann Arbor, MI 48105
tyler.erickson@anonymised.com
www.mtri.org
www.michiganview.org
Tyler Erickson ha scritto:
How would you write the cql_filter if you wanted to filter the records of one layer and return all the records of another layer? I tried ending the filter with a semi-colon, i.e.
&cql_Filter=LANAME%20=%20%22East%20River%22;
but I received an WMS error saying it could not parse cql_filter list. I am able to get it working using a dummy filter:
&cql_Filter=LANAME%20=%20%22East%20River%22;NAME<>%22DUMMY%22
but that seems pretty inelegant.
You can use the INCLUDE filter, which is the null filter for CQL:
&cql_Filter=LANAME%20=%20%22East%20River%22;INCLUDE
Also (out of curiosity), why use the semicolon as the list delimiter instead of the comma delimiter that is used by the layers and styles parameters?
Hum, don't know. CQL evolved separated from GeoServer, it comes from
the OGC catalog spec, where afaik filter lists are not part of the spec...
Anyways, cc'ed the geotools CQL module maintainer, he may have
an explanation (or maybe not
)
Cheers
Andrea
On Tuesday 11 March 2008 18:22:23 Andrea Aime wrote:
Hum, don't know. CQL evolved separated from GeoServer, it comes from
the OGC catalog spec, where afaik filter lists are not part of the spec...
Anyways, cc'ed the geotools CQL module maintainer, he may have
an explanation (or maybe not
)
Cheers
Andrea
A big compromise! well, "believe it or not" I have an explanation :D.
Really, that is not crystal clear in the CQL definition, but the intention of
CQL designer was to provide a language *based in SQL* , then when we extended
the original language we respected that idea. ";" is the sentence separator
in SQL this is the reason why we use ";".
If we maintain the language near the original the effect should be to reduce
the time to learn CQL.
cheers
--
Mauricio Pazos
www.axios.es
Tel.: +34 94 682 42 86