Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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=";
//--------------------------------------------------map
    $(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",
           "http://54.228.242.237:80/geoserver/us_admin/wms",
           {
           '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,                        
                }
           );
//---------------------------------------------------filters
                             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.setCenter(mapCenter,6);
//  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
add comment

1 Answer

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

or

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
add comment

Your Answer

 
discard

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.