0

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.

5
  • which example are you trying to use? what goes wrong? – Ian Turton Jan 8 '13 at 10:06
  • Are you using Geoserver? CQL filters don't work with any other WMS service. – user1702401 Jan 8 '13 at 10:07
  • Yes i m using geoserver and link Also i ve tried to many times . – rusty1119 Jan 8 '13 at 10:55
  • works for me - what is your actual problem – Ian Turton Jan 9 '13 at 15:44
  • share your code for people to look at where you might be wrong. – Aragon Jan 9 '13 at 17:05
1

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

0

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...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.