Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following code:

   var map = {};
   var googleMercator = new OpenLayers.Projection("EPSG:900913");
   var wgs84 = new OpenLayers.Projection("EPSG:4326");
   var lyr_osm = {};
   var texas = {};
   var lll = {};
   var query = {};
   var fin = {};
   var fout = {};
function init(){
    OpenLayers.ProxyHost = "proxy.cgi?url=";
    $(document).ready(function () {
    map = new OpenLayers.Map('map',
                    numZoomLevels: 18,
                    projection: googleMercator
//--------------------------------------------------layers definition
    var lyr_osm =new OpenLayers.Layer.OSM("OSM");
//--------------------------------------------------setting wms layer
       texas = new OpenLayers.Layer.WMS("Texas",
           'VERSION' : '1.1.0',
           layers: "us_states_gen",
           format: "image/png",
           transparent: true,
           cql_filter: "state_name LIKE 'Texas'",
                {isBaseLayer: false,
                visibility: true,
                sphericalMercator: true,                        
                             fin = new OpenLayers.Filter.Comparison({
                                     type: OpenLayers.Filter.Comparison.GREATER_THAN,
                                     property: "store_id",
                                     value: 500
                             fout = new OpenLayers.Filter.Comparison({
                                     type: OpenLayers.Filter.Comparison.LESS_THAN,
                                     property: "store_id",
                                     value: 100
                             query = new OpenLayers.Filter.Logical({
                                    type: OpenLayers.Filter.Logical.AND,
                                    filters: [fin, fout]

    var awfspc = new OpenLayers.Protocol.WFS({
        version: "1.1.0",
        url: 'http://loclahost/geoserver/stores/ows',
        featurePrefix: 'stores',
        featureType: 'stores',
            defaultFilter: fin,
            srsName: "EPSG:3857"        

    lll = new OpenLayers.Layer.Vector("Points", {
             externalGraphic: 'http://localhost/black_marker32.png', 
             graphicHeight: 20, 
             graphicWidth: 20,
          strategies: [new OpenLayers.Strategy.Refresh(), new OpenLayers.Strategy.Fixed()],
          protocol : awfspc,

//--------------------------------------------------------------------map controls
    map.addControl(new OpenLayers.Control.LayerSwitcher());
    map.addControl(new OpenLayers.Control.MousePosition());
//--------------------------------------------------------------------add Layers
    map.addLayers([lyr_osm, texas, lll]);
//--------------------------------------------------------------------map position
    var mapCenter = new OpenLayers.LonLat(-99, 31.3);
    mapCenter.transform(wgs84, googleMercator);
//  map.zoomToExtent();

When I use fin filter or fout filter, the filters are applied and they return good. When I use querry filter, nothing is returned, no error and no data.

Any clue? Thanks!

share|improve this question
up vote 2 down vote accepted

It's quite logical that

store_id >= 500 AND store_id <= 100

doesn't return anything. Probably you mean

store_id >= 500 OR store_id <= 100


store_id <= 500 AND store_id >= 100
share|improve this answer
Indeed, the fatigue got me. Thanks! – Niculita Mihai Jan 28 '13 at 21:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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