[OpenLayers-Users] How to use CQL filter in OpenLayers.Control.WMSGetFeatureInfo?
Ignacio Talavera
ignacio.talavera at gmail.com
Fri Jun 8 07:18:50 PDT 2012
Hi the WMSGetFeatureInfo manage additionals parameters of the url of the
GetFeatureInfo Request in *vendorparams* attribute.
So try to add this to your code
*var filter_param["cql_filter"] = prosjektnummer LIKE '%2008-25%' OR
prosjektnavn LIKE '%2008-25%*
info = new OpenLayers.Control.WMSGetFeatureInfo({
url: 'http://kart.naturkart.no/geoserver/wms',
title: 'Identify features by clicking',
queryVisible: true,
infoFormat:'application/vnd.ogc.gml',
*vendorParams:filter_param*
eventListeners: {
getfeatureinfo: function(event) {
if (popup) {
map.removePopup(popup);
} ........................
I hope this is useful to you.
Regards
Nacho
On Thu, Jun 7, 2012 at 11:48 AM, Asle Benoni <asle.benoni at gmail.com> wrote:
> I have made this map: www.babkart.no
>
> I have a search box that on select of the results sends a refresh of
> the layer with CQL parameters to GeoServer. This works.
> But of course when I click I get popups of all the markers, even if
> they are hidden because I understand that I send a WMS request without
> any filter.
>
> So I need help how to use the generated CQL params in my WMS request
> for GetFeautureInfo to GeoServer.
>
> My function CQLfilter in app.js on line 1027 produces this link:
> prosjektnummer LIKE '%2008-25%' OR prosjektnavn LIKE '%2008-25%
> which I use to filter the map.
>
> The question is how I can use this (or IF I can use it!) in my
> function (line 907):
>
> info = new OpenLayers.Control.WMSGetFeatureInfo({
> url: 'http://kart.naturkart.no/geoserver/wms',
> title: 'Identify features by clicking',
> queryVisible: true,
> infoFormat:'application/vnd.ogc.gml',
> eventListeners: {
> getfeatureinfo: function(event) {
> if (popup) {
> map.removePopup(popup);
> } ........................
>
> Any ideas on how to use the CQL code here?
>
> ~asle
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120608/6ccc635f/attachment-0001.html>
More information about the Users
mailing list