I've tried a lot of times to use the OpenLayers CQL example but nothing changes. Is there any way to use CQL or filter.
-
which example are you trying to use? what goes wrong?– Ian TurtonCommented Jan 8, 2013 at 10:06
-
Are you using Geoserver? CQL filters don't work with any other WMS service.– user1702401Commented Jan 8, 2013 at 10:07
-
Yes i m using geoserver and link Also i ve tried to many times .– rusty1119Commented Jan 8, 2013 at 10:55
-
works for me - what is your actual problem– Ian TurtonCommented Jan 9, 2013 at 15:44
-
share your code for people to look at where you might be wrong.– urcmCommented Jan 9, 2013 at 17:05
Add a comment
|
2 Answers
You have CQL in example:
STATE_ABBR >= 'B' AND STATE_ABBR <= 'O'
Try to change B to A and you will see change
STATE_ABBR >= 'A' AND STATE_ABBR <= 'O'
BTW OpenLayers supports less function then GeoServer but you can read http://docs.geoserver.org/stable/en/user/tutorials/cql/cql_tutorial.html
try to use this code:
lyr = new OpenLayers.Layer.WMS(yourLayerName, yourLayerService,{
'VERSION' : '1.1.0',
'layers' : yourLayerNum,
format: 'image/png',
transparent: true,
CQL_FILTER: "STATE_ABBR >= 'B' AND STATE_ABBR <= 'O'"
},
isBaseLayer: false
);
map.addLayer(lyr);
dont forget VERSION is important for getting true result.
i hope it helps you...